MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / GetNextRunFromMonitorKey

Function GetNextRunFromMonitorKey

cmd/root_windows.go:15–38  ·  view source on GitHub ↗

GetNextRunFromMonitorKey returns the NextRunTime timestamp from Windows Task Scheduler. Since each `cronitor ping` call is run independently, this call can't be memoized, regardless of how expensive it is.

(key string)

Source from the content-addressed store, hash-verified

13// Task Scheduler. Since each `cronitor ping` call is run independently,
14// this call can't be memoized, regardless of how expensive it is.
15func GetNextRunFromMonitorKey(key string) string {
16 taskService, err := taskmaster.Connect()
17 if err != nil {
18 log(fmt.Sprintf("err: %v", err))
19 return ""
20 }
21 defer taskService.Disconnect()
22 collection, err := taskService.GetRegisteredTasks()
23 if err != nil {
24 log(fmt.Sprintf("err: %v", err))
25 return ""
26 }
27 defer collection.Release()
28
29 for _, task := range collection {
30 t := NewWrappedWindowsTask(task)
31
32 if t.WindowsKey() == key {
33 return t.GetNextRunTimeString()
34 }
35 }
36
37 return ""
38}

Callers

nothing calls this directly

Calls 4

WindowsKeyMethod · 0.95
GetNextRunTimeStringMethod · 0.95
logFunction · 0.85
NewWrappedWindowsTaskFunction · 0.85

Tested by

no test coverage detected