MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Start

Method Start

internal/nodes/task_trim_disks.go:25–42  ·  view source on GitHub ↗

Start the task

()

Source from the content-addressed store, hash-verified

23
24// Start the task
25func (this *TrimDisksTask) Start() {
26 // execute once
27 if idles.IsMinHour() {
28 err := this.loop()
29 if err != nil {
30 remotelogs.Warn("TRIM_DISKS", "trim disks failed: "+err.Error())
31 }
32 }
33
34 var ticker = time.NewTicker(2 * 24 * time.Hour) // every 2 days
35 idles.RunTicker(ticker, func() {
36 // run the task
37 err := this.loop()
38 if err != nil {
39 remotelogs.Warn("TRIM_DISKS", "trim disks failed: "+err.Error())
40 }
41 })
42}
43
44// run the task once
45func (this *TrimDisksTask) loop() error {

Callers

nothing calls this directly

Calls 5

loopMethod · 0.95
IsMinHourFunction · 0.92
WarnFunction · 0.92
RunTickerFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected