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)) }