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

Function New

cron.go:113–131  ·  view source on GitHub ↗

New returns a new Cron job runner, modified by the given options. Available Settings Time Zone Description: The time zone in which schedules are interpreted Default: time.Local Parser Description: Parser converts cron spec strings into cron.Schedules. Default: Accepts this spec: https://e

(opts ...Option)

Source from the content-addressed store, hash-verified

111//
112// See "cron.With*" to modify the default behavior.
113func New(opts ...Option) *Cron {
114 c := &Cron{
115 entries: nil,
116 chain: NewChain(),
117 add: make(chan *Entry),
118 stop: make(chan struct{}),
119 snapshot: make(chan chan []Entry),
120 remove: make(chan EntryID),
121 running: false,
122 runningMu: sync.Mutex{},
123 logger: DefaultLogger,
124 location: time.Local,
125 parser: standardParser,
126 }
127 for _, opt := range opts {
128 opt(c)
129 }
130 return c
131}
132
133// FuncJob is a wrapper that turns a func() into a cron.Job
134type FuncJob func()

Callers 11

TestWithLocationFunction · 0.85
TestWithParserFunction · 0.85
TestWithVerboseLoggerFunction · 0.85
TestFuncPanicRecoveryFunction · 0.85
TestJobPanicRecoveryFunction · 0.85
TestSnapshotEntriesFunction · 0.85
TestNonLocalTimezoneFunction · 0.85
TestStopWithoutStartFunction · 0.85
TestInvalidJobSpecFunction · 0.85
newWithSecondsFunction · 0.85

Calls 1

NewChainFunction · 0.85

Tested by 11

TestWithLocationFunction · 0.68
TestWithParserFunction · 0.68
TestWithVerboseLoggerFunction · 0.68
TestFuncPanicRecoveryFunction · 0.68
TestJobPanicRecoveryFunction · 0.68
TestSnapshotEntriesFunction · 0.68
TestNonLocalTimezoneFunction · 0.68
TestStopWithoutStartFunction · 0.68
TestInvalidJobSpecFunction · 0.68
newWithSecondsFunction · 0.68