File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -193,16 +193,14 @@ func (worker *AzureWorker) killWorker() {
193193}
194194
195195func (pool * AzureWorkerPool ) DeleteInstance (generalworker * Worker ) {
196+ pool .parentPool .lock .Lock ()
196197 worker := (* pool .workers )[generalworker .workerId ]
197198 log .Printf ("Killing worker: %s" , worker .workerId )
198-
199- worker .killWorker ()
200-
201- pool .parentPool .lock .Lock ()
202199 delete (pool .parentPool .cleaningWorkers , generalworker .workerId )
203200 pool .parentPool .cleanedWorker = generalworker
204201 pool .parentPool .updateCluster ()
205202 if pool .parentPool .needRestart {
203+ log .Printf ("Stop killing, restart it\n " )
206204 pool .parentPool .needRestart = false
207205 pool .parentPool .lock .Unlock ()
208206 worker .startWorker ()
@@ -212,6 +210,7 @@ func (pool *AzureWorkerPool) DeleteInstance(generalworker *Worker) {
212210
213211 // delete the vm
214212 log .Printf ("Try to delete the vm" )
213+ worker .killWorker ()
215214 cleanupVM (worker )
216215
217216 pool .parentPool .lock .Lock ()
You can’t perform that action at this time.
0 commit comments