Skip to content

Commit 84dcda4

Browse files
committed
fix: Return from update loop when job completes
Update was running forever, which stopped jobs from timing out unless a restart occurred. This also fixes complete properly reporting an error.
1 parent 0c042dc commit 84dcda4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

provisionerd/provisionerd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ func (p *Server) runJob(ctx context.Context, job *proto.AcquiredJob) {
256256
return
257257
case <-ctx.Done():
258258
return
259+
case <-p.jobRunning:
260+
return
259261
case <-p.shutdown:
260262
p.opts.Logger.Info(ctx, "attempting graceful cancelation")
261263
shutdownCancel()
@@ -816,6 +818,7 @@ func (p *Server) completeJob(job *proto.CompletedJob) {
816818
}
817819
if err != nil {
818820
p.opts.Logger.Warn(p.closeContext, "failed to complete job", slog.Error(err))
821+
p.failActiveJobf(err.Error())
819822
return
820823
}
821824
break

0 commit comments

Comments
 (0)