summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-19 14:51:33 +0300
committerWolfy-J <[email protected]>2018-06-19 14:51:33 +0300
commitf83c58e52caa3f10b787b8305147cb2c13cdbd4a (patch)
treebf91fbd53014a3eec20a2b9cfd59f779bcb00d92 /service
parentf5d49284fa8c78cfbff93249f237349dbd2027f9 (diff)
better channel handling
Diffstat (limited to 'service')
-rw-r--r--service/container.go7
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()