Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84d07d4

Browse files
committed
Logging improvement
Signed-off-by: Danny Kopping <[email protected]>
1 parent f454184 commit 84d07d4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

coderd/notifications/notifier.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,17 @@ func (n *notifier) ensureRunning(ctx context.Context) (bool, error) {
131131
// resulting in a failed attempt for each notification when their contexts are canceled; this is not possible with the
132132
// default configurations but could be brought about by an operator tuning things incorrectly.
133133
func (n *notifier) process(ctx context.Context, success chan<- dispatchResult, failure chan<- dispatchResult) error {
134-
n.log.Debug(ctx, "checking for messages to dequeue")
135-
136134
msgs, err := n.fetch(ctx)
137135
if err != nil {
138136
return xerrors.Errorf("fetch messages: %w", err)
139137
}
140138

139+
n.log.Debug(ctx, "dequeued messages", slog.F("count", len(msgs)))
140+
141141
if len(msgs) == 0 {
142142
return nil
143143
}
144144

145-
n.log.Debug(ctx, "dequeued messages", slog.F("count", len(msgs)))
146-
147145
var eg errgroup.Group
148146
for _, msg := range msgs {
149147
// A message failing to be prepared correctly should not affect other messages.
@@ -167,7 +165,7 @@ func (n *notifier) process(ctx context.Context, success chan<- dispatchResult, f
167165
return xerrors.Errorf("dispatch failed: %w", err)
168166
}
169167

170-
n.log.Debug(ctx, "dispatch completed", slog.F("count", len(msgs)))
168+
n.log.Debug(ctx, "batch completed", slog.F("count", len(msgs)))
171169
return nil
172170
}
173171

0 commit comments

Comments
 (0)