From 66e96d57ac77469b2fe0ad4604b23b2386093f15 Mon Sep 17 00:00:00 2001 From: Dmitry Krylov Date: Mon, 3 Jan 2022 21:36:25 +0300 Subject: [PATCH] Update worker.go --- worker/worker.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/worker/worker.go b/worker/worker.go index 7ca1389..2214d54 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -219,6 +219,15 @@ func (worker *Worker) customeHandler(inpack *inPack) { } } +// Graceful shutdown for worker +func (worker *Worker) Stop() { + worker.Lock() + defer worker.Unlock() + if worker.running == true { + close(worker.in) + } +} + // Close connection and exit main loop func (worker *Worker) Close() { worker.Lock()