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

Function NewCron

enterprise/coderd/usage/cron.go:78–85  ·  view source on GitHub ↗

NewCron creates a Cron that periodically generates and inserts heartbeat events. The clock controls all timers so that tests can advance time deterministically via quartz.Mock.

(clock quartz.Clock, log slog.Logger, db database.Store, ins agplusage.Inserter)

Source from the content-addressed store, hash-verified

76// heartbeat events. The clock controls all timers so that tests can
77// advance time deterministically via quartz.Mock.
78func NewCron(clock quartz.Clock, log slog.Logger, db database.Store, ins agplusage.Inserter) *Cron {
79 return &Cron{
80 clock: clock,
81 log: log,
82 db: db,
83 ins: ins,
84 }
85}
86
87// Register adds a job. It must be called before Start; calling it
88// after Start returns an error.

Callers 2

TestCronFunction · 0.92
ServerMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestCronFunction · 0.74