diff options
author | Valery Piashchynski <[email protected]> | 2021-02-10 20:00:22 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-02-10 20:00:22 +0300 |
commit | ae3dd0c3672217be0b3fb4042ef650477fba108b (patch) | |
tree | da5b08308e5aff50a102f41e254ee3620d41550e /pkg/pool/static_pool.go | |
parent | da64d9fbab7d73e203e7dbbb9503f4d422feaab0 (diff) |
Rewrite container for the workers
Update tests
Diffstat (limited to 'pkg/pool/static_pool.go')
-rwxr-xr-x | pkg/pool/static_pool.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go index bb68151f..f1b20bb9 100755 --- a/pkg/pool/static_pool.go +++ b/pkg/pool/static_pool.go @@ -130,7 +130,8 @@ func (sp *StaticPool) Workers() (workers []worker.BaseProcess) { } func (sp *StaticPool) RemoveWorker(wb worker.BaseProcess) error { - return sp.ww.Remove(wb) + sp.ww.Remove(wb) + return nil } // Be careful, sync Exec with ExecWithContext @@ -208,6 +209,8 @@ func (sp *StaticPool) stopWorker(w worker.BaseProcess) { func (sp *StaticPool) checkMaxJobs(w worker.BaseProcess) error { const op = errors.Op("static_pool_check_max_jobs") if sp.cfg.MaxJobs != 0 && w.State().NumExecs() >= sp.cfg.MaxJobs { + w.State().Set(worker.StateDestroyed) + sp.ww.Remove(w) err := sp.ww.Allocate() if err != nil { return errors.E(op, err) |