Manager manages all notifications being enqueued and dispatched. Manager maintains a notifier: this consumes the queue of notification messages in the store. The notifier dequeues messages from the store _CODER_NOTIFICATIONS_LEASE_COUNT_ at a time and concurrently "dispatches" these messages, mean
| 39 | // we split notifiers out into separate targets for greater processing throughput; in this case we will need an |
| 40 | // alternative mechanism for handling backpressure. |
| 41 | type Manager struct { |
| 42 | cfg codersdk.NotificationsConfig |
| 43 | |
| 44 | store Store |
| 45 | log slog.Logger |
| 46 | |
| 47 | handlers map[database.NotificationMethod]Handler |
| 48 | method database.NotificationMethod |
| 49 | helpers template.FuncMap |
| 50 | |
| 51 | metrics *Metrics |
| 52 | |
| 53 | success, failure chan dispatchResult |
| 54 | |
| 55 | mu sync.Mutex // Protects following. |
| 56 | closed bool |
| 57 | notifier *notifier |
| 58 | |
| 59 | runOnce sync.Once |
| 60 | stop chan any |
| 61 | done chan any |
| 62 | |
| 63 | // clock is for testing only |
| 64 | clock quartz.Clock |
| 65 | } |
| 66 | |
| 67 | type ManagerOption func(*Manager) |
| 68 |
nothing calls this directly
no outgoing calls
no test coverage detected