diff options
author | Valery Piashchynski <[email protected]> | 2021-11-30 15:12:28 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-30 15:12:28 +0300 |
commit | c14e4fa638300ccd96bdedfb0200ed8378eebdf2 (patch) | |
tree | 4868eebfe26be611c3ef11547f64dc4cd5fd7f10 | |
parent | 06f1293149fad14e3a316d5f8f9264df7b938eb3 (diff) | |
parent | 8115c6325fe78185f86e819f2fc228708c7764b8 (diff) |
[#864]: upd(vector): redundant workers killv2.6.0
-rw-r--r-- | worker_watcher/container/channel/vec.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/worker_watcher/container/channel/vec.go b/worker_watcher/container/channel/vec.go index 958a217c..c0c27575 100644 --- a/worker_watcher/container/channel/vec.go +++ b/worker_watcher/container/channel/vec.go @@ -44,9 +44,12 @@ func (v *Vec) Push(w worker.BaseProcess) { 1. TTL is set with no requests during the TTL 2. Violated Get <-> Release operation (how ??) */ + for i := 0; i < len(v.workers); i++ { /* We need to drain vector until we found a worker in the Invalid/Killing/Killed/etc states. + BUT while we are draining the vector, some worker might be reallocated and pushed into the v.workers + so, down by the code, we might have a problem when pushing the new worker to the v.workers */ wrk := <-v.workers @@ -60,13 +63,10 @@ func (v *Vec) Push(w worker.BaseProcess) { case v.workers <- wrk: continue default: - // kill the new worker and reallocate it - w.State().Set(worker.StateInvalid) - _ = w.Kill() - // kill the worker from the channel wrk.State().Set(worker.StateInvalid) _ = wrk.Kill() + continue } /* |