Function
newNotifier
(outerCtx context.Context, cfg codersdk.NotificationsConfig, id uuid.UUID, log slog.Logger, db Store,
hr map[database.NotificationMethod]Handler, helpers template.FuncMap, metrics *Metrics, clock quartz.Clock,
)
Source from the content-addressed store, hash-verified
| 66 | } |
| 67 | |
| 68 | func newNotifier(outerCtx context.Context, cfg codersdk.NotificationsConfig, id uuid.UUID, log slog.Logger, db Store, |
| 69 | hr map[database.NotificationMethod]Handler, helpers template.FuncMap, metrics *Metrics, clock quartz.Clock, |
| 70 | ) *notifier { |
| 71 | gracefulCtx, gracefulCancel := context.WithCancel(outerCtx) |
| 72 | return ¬ifier{ |
| 73 | id: id, |
| 74 | cfg: cfg, |
| 75 | log: log.Named("notifier").With(slog.F("notifier_id", id)), |
| 76 | outerCtx: outerCtx, |
| 77 | gracefulCtx: gracefulCtx, |
| 78 | gracefulCancel: gracefulCancel, |
| 79 | done: make(chan any), |
| 80 | store: db, |
| 81 | handlers: hr, |
| 82 | helpers: helpers, |
| 83 | metrics: metrics, |
| 84 | clock: clock, |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | // run is the main loop of the notifier. |
| 89 | func (n *notifier) run(success chan<- dispatchResult, failure chan<- dispatchResult) error { |
Tested by
no test coverage detected