diff options
-rw-r--r-- | static_pool.go | 8 | ||||
-rw-r--r-- | watcher_test.go | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/static_pool.go b/static_pool.go index d81ef7e2..1409fc3f 100644 --- a/static_pool.go +++ b/static_pool.go @@ -122,14 +122,6 @@ func (p *StaticPool) Remove(w *Worker, err error) { } p.remove.Store(w, err) - - // cleanup workers which were scheduled for deletion after stop has been started - p.remove.Range(func(key, value interface{}) bool { - if key.(*Worker).State().Value() == StateStopped || key.(*Worker).State().Value() == StateErrored { - p.remove.Delete(key) - } - return true - }) } // Exec one task with given payload and context, returns result or error. diff --git a/watcher_test.go b/watcher_test.go index 4a46eaf1..94ac591e 100644 --- a/watcher_test.go +++ b/watcher_test.go @@ -168,6 +168,9 @@ func Test_RemoveWorkerOnAllocation(t *testing.T) { assert.NotEqual(t, lastPid, res.String()) assert.NotEqual(t, StateReady, wr.state.Value()) + + _, ok := rr.pool.(*StaticPool).remove.Load(wr) + assert.False(t, ok) } func Test_RemoveWorkerAfterTask(t *testing.T) { @@ -207,4 +210,7 @@ func Test_RemoveWorkerAfterTask(t *testing.T) { // must be replaced assert.NotEqual(t, lastPid, fmt.Sprintf("%v", rr.Workers()[0])) + + // must not be registered withing pool + rr.pWatcher.(*eWatcher).remove(wr, nil) } |