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

Method Stop

cron.go:323–336  ·  cron.go::Cron.Stop

Stop stops the cron scheduler if it is running; otherwise it does nothing. A context is returned so the caller can wait for running jobs to complete.

()

Source from the content-addressed store, hash-verified

321// Stop stops the cron scheduler if it is running; otherwise it does nothing.
322// A context is returned so the caller can wait for running jobs to complete.
323func (c *Cron) Stop() context.Context {
324 c.runningMu.Lock()
325 defer c.runningMu.Unlock()
326 if c.running {
327 c.stop <- struct{}{}
328 c.running = false
329 }
330 ctx, cancel := context.WithCancel(context.Background())
331 go func() {
332 c.jobWaiter.Wait()
333 cancel()
334 }()
335 return ctx
336}
337
338// entrySnapshot returns a copy of the current cron entry list.
339func (c *Cron) entrySnapshot() []Entry {

Callers 15

runMethod · 0.80
TestWithVerboseLoggerFunction · 0.80
TestFuncPanicRecoveryFunction · 0.80
TestJobPanicRecoveryFunction · 0.80
TestAddBeforeRunningFunction · 0.80
TestAddWhileRunningFunction · 0.80
TestRemoveBeforeRunningFunction · 0.80
TestRemoveWhileRunningFunction · 0.80
TestSnapshotEntriesFunction · 0.80
TestMultipleEntriesFunction · 0.80

Calls

no outgoing calls

Tested by 15

TestWithVerboseLoggerFunction · 0.64
TestFuncPanicRecoveryFunction · 0.64
TestJobPanicRecoveryFunction · 0.64
TestAddBeforeRunningFunction · 0.64
TestAddWhileRunningFunction · 0.64
TestRemoveBeforeRunningFunction · 0.64
TestRemoveWhileRunningFunction · 0.64
TestSnapshotEntriesFunction · 0.64
TestMultipleEntriesFunction · 0.64
TestRunningJobTwiceFunction · 0.64