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

Method Start

enterprise/coderd/usage/cron.go:102–113  ·  view source on GitHub ↗

Start launches a goroutine per job. Subsequent calls are no-ops. On daemon restart a new Cron should be created.

(ctx context.Context)

Source from the content-addressed store, hash-verified

100// Start launches a goroutine per job. Subsequent calls are no-ops.
101// On daemon restart a new Cron should be created.
102func (c *Cron) Start(ctx context.Context) {
103 c.startOnce.Do(func() {
104 c.started.Store(true)
105 ctx, c.cancel = context.WithCancel(ctx)
106 for _, job := range c.jobs {
107 c.wg.Add(1)
108 pproflabel.Go(ctx, pproflabel.Service(pproflabel.ServiceUsageEventCron, "job", job.Name), func(ctx context.Context) {
109 c.run(ctx, job)
110 })
111 }
112 })
113}
114
115// Close cancels all jobs and waits for goroutines to exit.
116func (c *Cron) Close() error {

Callers 2

TestCronFunction · 0.95
ServerMethod · 0.95

Calls 6

runMethod · 0.95
GoFunction · 0.92
ServiceFunction · 0.92
DoMethod · 0.65
AddMethod · 0.65
StoreMethod · 0.45

Tested by 1

TestCronFunction · 0.76