Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
chore: do not delete the last worker
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
  • Loading branch information
rustatian committed Jun 25, 2024
1 parent f4ca750 commit 82e59c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions worker_watcher/worker_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ func (ww *WorkerWatcher) RemoveWorker(ctx context.Context) error {
return err
}

// can't remove the last worker
if atomic.LoadUint64(&ww.numWorkers) == 1 {
ww.log.Warn("can't remove the last worker", zap.Int64("pid", w.Pid()))
return nil
}

// destroy and stop
w.State().Transition(fsm.StateDestroyed)
_ = w.Stop()
Expand Down

0 comments on commit 82e59c0

Please sign in to comment.