summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-14 23:56:56 +0300
committerValery Piashchynski <[email protected]>2021-08-14 23:56:56 +0300
commit3383860a5e8ae8ef59b7b552b2228d5327511ab6 (patch)
treee3cebc99591ed11069a3f3889d43cac59b26702f /pkg
parent891df1a8c8db3d61ce7f4e9ba77076369a9a9ce3 (diff)
Kill worker instead of stop while error occured.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rwxr-xr-xpkg/pool/static_pool.go4
-rw-r--r--pkg/pool/supervisor_test.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go
index 051e7a8a..b20e4242 100755
--- a/pkg/pool/static_pool.go
+++ b/pkg/pool/static_pool.go
@@ -272,7 +272,9 @@ func defaultErrEncoder(sp *StaticPool) ErrorEncoder {
w.State().Set(worker.StateInvalid)
sp.events.Push(events.PoolEvent{Event: events.EventWorkerDestruct, Payload: w})
- errS := w.Stop()
+ // kill worker instead of stop, because worker here might be in the broken state (network) which leads us
+ // to the error
+ errS := w.Kill()
if errS != nil {
return nil, errors.E(op, err, errS)
}
diff --git a/pkg/pool/supervisor_test.go b/pkg/pool/supervisor_test.go
index 0702a71f..39d8abb1 100644
--- a/pkg/pool/supervisor_test.go
+++ b/pkg/pool/supervisor_test.go
@@ -39,6 +39,8 @@ func TestSupervisedPool_Exec(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, p)
+ time.Sleep(time.Second)
+
pidBefore := p.Workers()[0].Pid()
for i := 0; i < 100; i++ {