@@ -50,12 +50,12 @@ func New(clientDialer Dialer, opts *Options) io.Closer {
5050}
5151ctx ,ctxCancel := context .WithCancel (context .Background ())
5252daemon := & 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 {}),
5959}
6060go daemon .connect (ctx )
6161return daemon
@@ -185,8 +185,6 @@ func (p *provisionerDaemon) acquireJob(ctx context.Context) {
185185p .acquiredJobCancelled .Store (false )
186186p .acquiredJobRunning .Store (true )
187187
188- p .acquiredJobDone = make (chan struct {})
189-
190188p .opts .Logger .Info (context .Background (),"acquired job" ,
191189slog .F ("job_id" ,p .acquiredJob .JobId ),
192190slog .F ("organization_name" ,p .acquiredJob .OrganizationName ),
@@ -515,15 +513,6 @@ func (p *provisionerDaemon) closeWithError(err error) error {
515513}
516514
517515if 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-
527516errMsg := "provisioner daemon was shutdown gracefully"
528517if err != nil {
529518errMsg = err .Error ()