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)
| 76 | // heartbeat events. The clock controls all timers so that tests can |
| 77 | // advance time deterministically via quartz.Mock. |
| 78 | func 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. |