diff options
author | Wolfy-J <[email protected]> | 2019-05-05 12:06:04 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-05 12:06:04 +0300 |
commit | ee12d7b834b501beed56945a54fdabe8bbdd4570 (patch) | |
tree | b4eb26e5fba83124f7eab3979bd4e13e7d4a190e /service/limit/controller.go | |
parent | db838d7465cc6b147c5d7f672d71c6523df54209 (diff) |
init service
Diffstat (limited to 'service/limit/controller.go')
-rw-r--r-- | service/limit/controller.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/service/limit/controller.go b/service/limit/controller.go index 3e6aed4b..706197fa 100644 --- a/service/limit/controller.go +++ b/service/limit/controller.go @@ -32,11 +32,11 @@ type controllerConfig struct { // TTL defines maximum time worker is allowed to live. TTL int64 - // MaxIdleTTL defines maximum duration worker can spend in idle mode. - MaxIdleTTL int64 + // IdleTTL defines maximum duration worker can spend in idle mode. + IdleTTL int64 - // MaxExecTTL defines maximum lifetime per job. - MaxExecTTL int64 + // ExecTTL defines maximum lifetime per job. + ExecTTL int64 } type controller struct { @@ -56,13 +56,13 @@ func (c *controller) control(p roadrunner.Pool) { now := time.Now() - if c.cfg.MaxExecTTL != 0 { + if c.cfg.ExecTTL != 0 { for _, w := range c.sw.find( roadrunner.StateWorking, - now.Add(-time.Second*time.Duration(c.cfg.MaxExecTTL)), + now.Add(-time.Second*time.Duration(c.cfg.ExecTTL)), ) { eID := w.State().NumExecs() - err := fmt.Errorf("max exec time reached (%vs)", c.cfg.MaxExecTTL) + err := fmt.Errorf("max exec time reached (%vs)", c.cfg.ExecTTL) // make sure worker still on initial request if p.Remove(w, err) && w.State().NumExecs() == eID { @@ -73,12 +73,12 @@ func (c *controller) control(p roadrunner.Pool) { } // locale workers which are in idle mode for too long - if c.cfg.MaxIdleTTL != 0 { + if c.cfg.IdleTTL != 0 { for _, w := range c.sw.find( roadrunner.StateReady, - now.Add(-time.Second*time.Duration(c.cfg.MaxIdleTTL)), + now.Add(-time.Second*time.Duration(c.cfg.IdleTTL)), ) { - err := fmt.Errorf("max idle time reached (%vs)", c.cfg.MaxIdleTTL) + err := fmt.Errorf("max idle time reached (%vs)", c.cfg.IdleTTL) if p.Remove(w, err) { c.report(EventMaxIdleTTL, w, err) } |