diff options
Diffstat (limited to 'service/watcher/watcher.go')
-rw-r--r-- | service/watcher/watcher.go | 10 |
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) + } } } } |