summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
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)