@@ -50,12 +50,12 @@ func New(clientDialer Dialer, opts *Options) io.Closer {
50
50
}
51
51
ctx ,ctxCancel := context .WithCancel (context .Background ())
52
52
daemon := & provisionerDaemon {
53
- clientDialer :clientDialer ,
54
- opts :opts ,
55
-
56
- closeContext :ctx ,
57
- closeCancel :ctxCancel ,
58
- closed :make (chan struct {}),
53
+ clientDialer :clientDialer ,
54
+ opts :opts ,
55
+ acquiredJobDone : make ( chan struct {}),
56
+ closeContext :ctx ,
57
+ closeCancel :ctxCancel ,
58
+ closed :make (chan struct {}),
59
59
}
60
60
go daemon .connect (ctx )
61
61
return daemon
@@ -185,8 +185,6 @@ func (p *provisionerDaemon) acquireJob(ctx context.Context) {
185
185
p .acquiredJobCancelled .Store (false )
186
186
p .acquiredJobRunning .Store (true )
187
187
188
- p .acquiredJobDone = make (chan struct {})
189
-
190
188
p .opts .Logger .Info (context .Background (),"acquired job" ,
191
189
slog .F ("job_id" ,p .acquiredJob .JobId ),
192
190
slog .F ("organization_name" ,p .acquiredJob .OrganizationName ),
@@ -515,15 +513,6 @@ func (p *provisionerDaemon) closeWithError(err error) error {
515
513
}
516
514
517
515
if p .isRunningJob () {
518
- // We also need the 'acquire job' mutex here,
519
- // so that a new `p.acquiredJobDone` channel isn't created
520
- // while we're waiting on the mutex.
521
-
522
- // Note the mutex order - it's important that we always use the same order of acquisition
523
- // to avoid deadlocks
524
- p .acquiredJobMutex .Lock ()
525
- defer p .acquiredJobMutex .Unlock ()
526
-
527
516
errMsg := "provisioner daemon was shutdown gracefully"
528
517
if err != nil {
529
518
errMsg = err .Error ()