MCPcopy
hub / github.com/robfig/cron / SkipIfStillRunning

Function SkipIfStillRunning

chain.go:78–92  ·  view source on GitHub ↗

SkipIfStillRunning skips an invocation of the Job if a previous invocation is still running. It logs skips to the given logger at Info level.

(logger Logger)

Source from the content-addressed store, hash-verified

76// SkipIfStillRunning skips an invocation of the Job if a previous invocation is
77// still running. It logs skips to the given logger at Info level.
78func SkipIfStillRunning(logger Logger) JobWrapper {
79 return func(j Job) Job {
80 var ch = make(chan struct{}, 1)
81 ch <- struct{}{}
82 return FuncJob(func() {
83 select {
84 case v := <-ch:
85 j.Run()
86 ch <- v
87 default:
88 logger.Info("skip")
89 }
90 })
91 }
92}

Callers 1

Calls 3

FuncJobFuncType · 0.85
RunMethod · 0.65
InfoMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…