diff options
author | Wolfy-J <[email protected]> | 2019-05-03 12:37:47 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-03 12:37:47 +0300 |
commit | b5decb711e550242bd0e057f8867b7ec85e423b7 (patch) | |
tree | c7a634787038ab315316f30a6538473293168f3a /service/http | |
parent | 0f434c18e6c4b6934f47c3f6876c359bca31f9a7 (diff) |
bump golang version
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/service.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/service/http/service.go b/service/http/service.go index 47175ec3..716499a4 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -33,11 +33,17 @@ type Service struct { mdwr []middleware mu sync.Mutex rr *roadrunner.Server + watcher roadrunner.Watcher handler *Handler http *http.Server https *http.Server } +// Watch attaches watcher. +func (s *Service) AttachWatcher(w roadrunner.Watcher) { + s.watcher = w +} + // AddMiddleware adds new net/http mdwr. func (s *Service) AddMiddleware(m middleware) { s.mdwr = append(s.mdwr, m) @@ -78,6 +84,10 @@ func (s *Service) Serve() error { s.rr = roadrunner.NewServer(s.cfg.Workers) s.rr.Listen(s.throw) + if s.watcher != nil { + s.rr.Watch(s.watcher) + } + s.handler = &Handler{cfg: s.cfg, rr: s.rr} s.handler.Listen(s.throw) |