summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-03 12:37:47 +0300
committerWolfy-J <[email protected]>2019-05-03 12:37:47 +0300
commitb5decb711e550242bd0e057f8867b7ec85e423b7 (patch)
treec7a634787038ab315316f30a6538473293168f3a /service/http
parent0f434c18e6c4b6934f47c3f6876c359bca31f9a7 (diff)
bump golang version
Diffstat (limited to 'service/http')
-rw-r--r--service/http/service.go10
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)