From e05c84027ccdadb47cb42cf98b999878bc928a7c Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Tue, 19 Jul 2016 17:30:40 +0200 Subject: [PATCH] Re-open closed channels after stop --- shezmu.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shezmu.go b/shezmu.go index 69eb1bd..9bf04d6 100644 --- a/shezmu.go +++ b/shezmu.go @@ -125,9 +125,15 @@ func (s *Shezmu) StopDaemons() { s.wgSystem.Wait() close(s.shutdownWorkers) + s.wgWorkers.Wait() close(s.queue) + // Re-open closed channels to allow starting new deamons afterwards + s.shutdownSystem = make(chan struct{}) + s.shutdownWorkers = make(chan struct{}) + s.queue = make(chan *task) + fmt.Println(s.runtimeStats.Fetch(stats.Latency)) }