MCPcopy Index your code
hub / github.com/coder/coder / Register

Method Register

enterprise/coderd/usage/cron.go:89–98  ·  view source on GitHub ↗

Register adds a job. It must be called before Start; calling it after Start returns an error.

(job CronJob)

Source from the content-addressed store, hash-verified

87// Register adds a job. It must be called before Start; calling it
88// after Start returns an error.
89func (c *Cron) Register(job CronJob) error {
90 if !job.EventType.IsHeartbeat() {
91 return xerrors.New("event type must be a heartbeat type")
92 }
93 if c.started.Load() {
94 return xerrors.New("cannot register a job after Start has been called")
95 }
96 c.jobs = append(c.jobs, job)
97 return nil
98}
99
100// Start launches a goroutine per job. Subsequent calls are no-ops.
101// On daemon restart a new Cron should be created.

Callers 8

TestCronFunction · 0.95
ServerMethod · 0.95
NewFunction · 0.45
NewStoreReconcilerFunction · 0.45
TestMetricsCollectorFunction · 0.45

Calls 3

IsHeartbeatMethod · 0.80
NewMethod · 0.65
LoadMethod · 0.45