From 8c789bec56646342cc16818ef6c2f646aaa679f5 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Tue, 14 Dec 2021 13:21:12 +0300 Subject: protect destroy operation with mutex Signed-off-by: Valery Piashchynski --- pool/supervisor_pool.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pool/supervisor_pool.go b/pool/supervisor_pool.go index b01520e2..3dbae417 100755 --- a/pool/supervisor_pool.go +++ b/pool/supervisor_pool.go @@ -87,8 +87,10 @@ func (sp *supervised) RemoveWorker(worker worker.BaseProcess) error { } func (sp *supervised) Destroy(ctx context.Context) { - sp.pool.Destroy(ctx) sp.Stop() + sp.mu.Lock() + sp.pool.Destroy(ctx) + sp.mu.Unlock() } func (sp *supervised) Start() { -- cgit v1.2.3