diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/container.go | 4 | ||||
-rw-r--r-- | service/http/service.go | 2 | ||||
-rw-r--r-- | service/rpc/service.go | 2 | ||||
-rw-r--r-- | service/rpc/system.go | 2 | ||||
-rw-r--r-- | service/watcher/watcher.go | 49 |
5 files changed, 5 insertions, 54 deletions
diff --git a/service/container.go b/service/container.go index 275cfffd..6aa99614 100644 --- a/service/container.go +++ b/service/container.go @@ -22,7 +22,7 @@ type Service interface { // Serve serves. Serve() error - // Stop stops the service. + // Detach stops the service. Stop() } @@ -198,7 +198,7 @@ func (c *container) Serve() error { return nil } -// Stop sends stop command to all running services. +// Detach sends stop command to all running services. func (c *container) Stop() { for _, e := range c.services { if e.hasStatus(StatusServing) { diff --git a/service/http/service.go b/service/http/service.go index 6e4542bf..1a06a76a 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -103,7 +103,7 @@ func (s *Service) Serve() error { return <-err } -// Stop stops the svc. +// Detach stops the svc. func (s *Service) Stop() { s.mu.Lock() defer s.mu.Unlock() diff --git a/service/rpc/service.go b/service/rpc/service.go index eba74c2d..066124a2 100644 --- a/service/rpc/service.go +++ b/service/rpc/service.go @@ -83,7 +83,7 @@ func (s *Service) Serve() error { return nil } -// Stop stops the service. +// Detach stops the service. func (s *Service) Stop() { s.mu.Lock() defer s.mu.Unlock() diff --git a/service/rpc/system.go b/service/rpc/system.go index 778250ad..d1368a05 100644 --- a/service/rpc/system.go +++ b/service/rpc/system.go @@ -7,7 +7,7 @@ type systemService struct { c service.Container } -// Stop the underlying c. +// Detach the underlying c. func (s *systemService) Stop(stop bool, r *string) error { if stop { s.c.Stop() diff --git a/service/watcher/watcher.go b/service/watcher/watcher.go index 9cf129df..8278790e 100644 --- a/service/watcher/watcher.go +++ b/service/watcher/watcher.go @@ -1,50 +1 @@ package watcher - -import ( - "log" - "time" -) - -// disconnect?? -type Service struct { - // defines how often - interval time.Duration - pool Pool - - stop chan interface{} -} - -// NewWatcher creates new pool watcher. -func NewWatcher(p Pool, i time.Duration) *Service { - w := &Service{ - interval: i, - pool: p, - stop: make(chan interface{}), - } - - go func() { - ticker := time.NewTicker(w.interval) - - for { - select { - case <-ticker.C: - w.update() - case <-w.stop: - return - } - } - }() - - return w -} - -func (w *Service) Stop() { - close(w.stop) -} - -func (w *Service) update() { - for _, w := range w.pool.Workers() { - log.Println(w) - - } -} |