summaryrefslogtreecommitdiff
path: root/service/container.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-03-14 00:57:28 +0300
committerValery Piashchynski <[email protected]>2020-03-14 00:57:28 +0300
commit4ae5a7e7213798892d511a7a53ecd148e22ca7f6 (patch)
treec246bb679d5ba3f8bdb4857df074d9ea51e9deeb /service/container.go
parentbb96eee28c4a171ad663861e08fce73708ce09ad (diff)
Fix panic in Serve
Add test for the bug Uncomment test in container. It's working properly now
Diffstat (limited to 'service/container.go')
-rw-r--r--service/container.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/container.go b/service/container.go
index 85f63eeb..77a6dfc0 100644
--- a/service/container.go
+++ b/service/container.go
@@ -166,8 +166,10 @@ func (c *container) Init(cfg Config) error {
// Serve all configured services. Non blocking.
func (c *container) Serve() error {
+ var running = 0
for _, e := range c.services {
if e.hasStatus(StatusOK) && e.canServe() {
+ running++
c.log.Debugf("[%s]: started", e.name)
go func(e *entry) {
e.setStatus(StatusServing)
@@ -187,6 +189,11 @@ func (c *container) Serve() error {
}
}
+ // simple handler to handle empty configs
+ if running == 0 {
+ return nil
+ }
+
for fail := range c.errc {
if fail.err == errTempFix223 {
// if we call stop, then stop all plugins