Merge branch '20522-load-dispatch-priv-key'
[arvados.git] / lib / dispatchcloud / worker / pool.go
index 3de207ffa0e4eaf26bea0200e2aebc6ff7b1d7c4..1d600e37020ec0f26108e1997adb79c1f787839c 100644 (file)
@@ -908,6 +908,9 @@ func (wp *Pool) Instances() []InstanceView {
 // KillInstance destroys a cloud VM instance. It returns an error if
 // the given instance does not exist.
 func (wp *Pool) KillInstance(id cloud.InstanceID, reason string) error {
+       wp.setupOnce.Do(wp.setup)
+       wp.mtx.Lock()
+       defer wp.mtx.Unlock()
        wkr, ok := wp.workers[id]
        if !ok {
                return errors.New("instance not found")