diff options
Diffstat (limited to 'pool/static_pool.go')
-rwxr-xr-x | pool/static_pool.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pool/static_pool.go b/pool/static_pool.go index 9636f19f..4906788f 100755 --- a/pool/static_pool.go +++ b/pool/static_pool.go @@ -318,7 +318,6 @@ func (sp *StaticPool) execDebug(p *payload.Payload) (*payload.Payload, error) { }() // destroy the worker - sw.State().Set(worker.StateDestroyed) err = sw.Stop() if err != nil { sp.events.Send(events.NewEvent(events.EventWorkerError, pluginName, fmt.Sprintf("error: %s, worker's pid: %d", err, sw.Pid()))) @@ -346,9 +345,10 @@ func (sp *StaticPool) execDebugWithTTL(ctx context.Context, p *payload.Payload) _ = sw.Wait() }() - sw.State().Set(worker.StateDestroyed) - if stopErr := sw.Stop(); stopErr != nil { - sp.events.Send(events.NewEvent(events.EventWorkerError, pluginName, fmt.Sprintf("error: %s, pid: %d", err, sw.Pid()))) + err = sw.Stop() + if err != nil { + sp.events.Send(events.NewEvent(events.EventWorkerError, pluginName, fmt.Sprintf("error: %s, worker's pid: %d", err, sw.Pid()))) + return nil, err } return r, err |