summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-19 13:17:22 +0300
committerWolfy-J <[email protected]>2019-05-19 13:17:22 +0300
commit8b3967e595b410be302602aeef1da8ce2b3feb1c (patch)
tree2f840ff52eed68c43aa4070ac2b8a9a38c57995c
parentd8e9f83f0fb88e4b5b6432e1f82f34e4243e4302 (diff)
better contrainer stop
-rw-r--r--service/container.go1
-rw-r--r--service/entry.go11
2 files changed, 8 insertions, 4 deletions
diff --git a/service/container.go b/service/container.go
index 1cf4a5f6..1e2e1d51 100644
--- a/service/container.go
+++ b/service/container.go
@@ -202,6 +202,7 @@ func (c *container) Serve() error {
func (c *container) Stop() {
for _, e := range c.services {
if e.hasStatus(StatusServing) {
+ e.setStatus(StatusStopping)
e.svc.(Service).Stop()
e.setStatus(StatusStopped)
diff --git a/service/entry.go b/service/entry.go
index b8da6514..497742d1 100644
--- a/service/entry.go
+++ b/service/entry.go
@@ -8,16 +8,19 @@ const (
// StatusUndefined when service bus can not find the service.
StatusUndefined = iota
- // StatusInactive hasStatus setStatus when service has been registered in container.
+ // StatusInactive when service has been registered in container.
StatusInactive
- // StatusOK hasStatus setStatus when service has been properly configured.
+ // StatusOK when service has been properly configured.
StatusOK
- // StatusServing hasStatus setStatus when service hasStatus currently done.
+ // StatusServing when service is currently done.
StatusServing
- // StatusStopped hasStatus setStatus when service hasStatus stopped.
+ // StatusStopping when service is currently stopping.
+ StatusStopping
+
+ // StatusStopped when service being stopped.
StatusStopped
)