diff options
author | Valery Piashchynski <[email protected]> | 2021-10-27 22:42:07 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-10-27 22:42:07 +0300 |
commit | 52a6b1b2fc3eaf3cda5594825f3c5a9ae8a9452b (patch) | |
tree | 296d48dab1d5396313c061fbfc930a97af0df9f4 /worker/worker.go | |
parent | 15e6f474ef1340f4e93f213bab1cb9548e51a1e8 (diff) |
Make sure events bus properly closed
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'worker/worker.go')
-rwxr-xr-x | worker/worker.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/worker/worker.go b/worker/worker.go index 5973adc6..05c6dd0d 100755 --- a/worker/worker.go +++ b/worker/worker.go @@ -135,6 +135,7 @@ func (w *Process) Wait() error { const op = errors.Op("process_wait") var err error err = w.cmd.Wait() + defer w.events.Unsubscribe(w.eventsID) // If worker was destroyed, just exit if w.State().Value() == StateDestroyed { @@ -162,8 +163,6 @@ func (w *Process) Wait() error { return nil } - w.events.Unsubscribe(w.eventsID) - return err } @@ -221,11 +220,6 @@ func (w *Process) Kill() error { // Worker stderr func (w *Process) Write(p []byte) (n int, err error) { - w.events.Send(&events.RREvent{ - T: events.EventWorkerStderr, - P: workerEventsName, - M: utils.AsString(p), - }) - + w.events.Send(events.NewEvent(events.EventWorkerStderr, workerEventsName, utils.AsString(p))) return len(p), nil } |