summaryrefslogtreecommitdiff
path: root/service/watcher/watcher.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-04 18:47:12 +0300
committerWolfy-J <[email protected]>2019-05-04 18:47:12 +0300
commit17c259e8e0a7988b4336643c4d180733663dbaa3 (patch)
tree157faa2b009e648ba17fbce86fa6ac2a08ade42a /service/watcher/watcher.go
parent5f0fa44cc1b2ad377eb0832ec7e4f2337fc843b4 (diff)
real ip + better stop sequence
Diffstat (limited to 'service/watcher/watcher.go')
-rw-r--r--service/watcher/watcher.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/service/watcher/watcher.go b/service/watcher/watcher.go
index 08d477fa..e92d0677 100644
--- a/service/watcher/watcher.go
+++ b/service/watcher/watcher.go
@@ -92,11 +92,15 @@ func (wch *watcher) watch(p roadrunner.Pool) {
roadrunner.StateWorking,
now.Add(-time.Second*time.Duration(wch.cfg.MaxExecTTL)),
) {
+ eID := w.State().NumExecs()
err := fmt.Errorf("max exec time reached (%vs)", wch.cfg.MaxExecTTL)
+
if p.Remove(w, err) {
- // brutally
- go w.Kill()
- wch.report(EventMaxExecTTL, w, err)
+ // make sure worker still on initial request
+ if w.State().NumExecs() == eID {
+ go w.Kill()
+ wch.report(EventMaxExecTTL, w, err)
+ }
}
}
}