diff options
author | Wolfy-J <[email protected]> | 2018-06-19 14:51:33 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-19 14:51:33 +0300 |
commit | f83c58e52caa3f10b787b8305147cb2c13cdbd4a (patch) | |
tree | bf91fbd53014a3eec20a2b9cfd59f779bcb00d92 | |
parent | f5d49284fa8c78cfbff93249f237349dbd2027f9 (diff) |
better channel handling
-rw-r--r-- | service/container.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/service/container.go b/service/container.go index 931efd3c..0987b1ae 100644 --- a/service/container.go +++ b/service/container.go @@ -141,6 +141,8 @@ func (c *container) Serve() error { if err := e.svc.Serve(); err != nil { c.log.Errorf("[%s]: %s", e.name, err) done <- errors.Wrap(err, fmt.Sprintf("[%s]", e.name)) + } else { + done <- nil } }(e) } @@ -148,6 +150,11 @@ func (c *container) Serve() error { for i := 0; i < numServing; i++ { result := <-done + if result == nil { + // no errors + continue + } + // found an error in one of the services, stopping the rest of running services. if err := result.(error); err != nil { c.Stop() |