diff options
author | Valery Piashchynski <[email protected]> | 2020-02-23 16:24:45 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-23 16:24:45 +0300 |
commit | 8602c72a17f8ecabef2355d1d24ad569239f7bfa (patch) | |
tree | f36f7b650755bc42f9fd7b64f8de0d90f4cefa96 /service/reload | |
parent | 88c13f9709bbb0033dddca21e181a5d62f7317e7 (diff) |
Send message to the service stop channel
Diffstat (limited to 'service/reload')
-rw-r--r-- | service/reload/service.go | 1 | ||||
-rw-r--r-- | service/reload/watcher.go | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/service/reload/service.go b/service/reload/service.go index d5b6a024..7bfb0f28 100644 --- a/service/reload/service.go +++ b/service/reload/service.go @@ -161,4 +161,5 @@ func (s *Service) Serve() error { func (s *Service) Stop() { s.watcher.Stop() + s.stopc <- struct{}{} } diff --git a/service/reload/watcher.go b/service/reload/watcher.go index d5211d19..a3b8fe1f 100644 --- a/service/reload/watcher.go +++ b/service/reload/watcher.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "sync" "time" ) @@ -225,7 +226,9 @@ func (w *Watcher) waitEvent(d time.Duration) error { select { case <-w.close: ticker.Stop() - return nil + // just exit + // no matter for the pollEvents + runtime.Goexit() case <-ticker.C: // this is not very effective way // because we have to wait on Lock |