Skip to content

Commit 0ddd54d

Browse files
authored
fix(coderd/provisionerdserver): avoid error log during shutdown (coder#10402)
1 parent fdc9097 commit 0ddd54d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,13 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
12061206
case <-wait:
12071207
// Wait for the next potential timeout to occur.
12081208
if err := s.Pubsub.Publish(codersdk.WorkspaceNotifyChannel(workspaceBuild.WorkspaceID), []byte{}); err != nil {
1209+
if s.lifecycleCtx.Err() != nil {
1210+
// If the server is shutting down, we don't want to log this error, nor wait around.
1211+
s.Logger.Debug(ctx, "stopping notifications due to server shutdown",
1212+
slog.F("workspace_build_id", workspaceBuild.ID),
1213+
)
1214+
return
1215+
}
12091216
s.Logger.Error(ctx, "workspace notification after agent timeout failed",
12101217
slog.F("workspace_build_id", workspaceBuild.ID),
12111218
slog.Error(err),

0 commit comments

Comments
 (0)