Skip to content

Commit 7e5b4cc

Browse files
committed
make gen
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 7db2e56 commit 7e5b4cc

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

coderd/database/queries.sql.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/notifications/manager.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ type Manager struct {
6060
// helpers is a map of template helpers which are used to customize notification messages to use global settings like
6161
// access URL etc.
6262
func NewManager(cfg codersdk.NotificationsConfig, store Store, metrics *Metrics, log slog.Logger) (*Manager, error) {
63-
if metrics == nil {
64-
panic("nil metrics passed to notifications manager")
65-
}
66-
6763
method, err := dispatchMethodFromCfg(cfg)
6864
if err != nil {
6965
return nil, err
@@ -211,6 +207,11 @@ func (m *Manager) BufferedUpdatesCount() (success int, failure int) {
211207

212208
// syncUpdates updates messages in the store based on the given successful and failed message dispatch results.
213209
func (m *Manager) syncUpdates(ctx context.Context) {
210+
// Ensure we update the metrics to reflect the current state after each invocation.
211+
defer func() {
212+
m.metrics.PendingUpdates.Set(float64(len(m.success) + len(m.failure)))
213+
}()
214+
214215
select {
215216
case <-ctx.Done():
216217
return
@@ -220,10 +221,6 @@ func (m *Manager) syncUpdates(ctx context.Context) {
220221
nSuccess := len(m.success)
221222
nFailure := len(m.failure)
222223

223-
defer func() {
224-
m.metrics.PendingUpdates.Set(float64(len(m.success) + len(m.failure)))
225-
}()
226-
227224
// Nothing to do.
228225
if nSuccess+nFailure == 0 {
229226
return

coderd/notifications/notifications_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ func TestInvalidConfig(t *testing.T) {
516516
cfg.LeasePeriod = serpent.Duration(leasePeriod)
517517
cfg.DispatchTimeout = serpent.Duration(leasePeriod)
518518

519-
// TODO
520519
_, err := notifications.NewManager(cfg, db, createMetrics(), logger.Named("manager"))
521520
require.ErrorIs(t, err, notifications.ErrInvalidDispatchTimeout)
522521
}

0 commit comments

Comments
 (0)