mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-18 03:37:33 +08:00
autonomy: avoid immediate redispatch of running tasks after restart until pending timeout
This commit is contained in:
@@ -350,6 +350,11 @@ func (e *Engine) tick() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Keep running tasks intact across ticks/restarts until pending timeout,
|
||||||
|
// so a gateway restart won't immediately redispatch from scratch.
|
||||||
|
if !st.LastRunAt.IsZero() && now.Sub(st.LastRunAt) <= time.Duration(e.opts.MaxPendingDurationSec)*time.Second {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if st.Status == "blocked" {
|
if st.Status == "blocked" {
|
||||||
e.releaseLocksLocked(st.ID)
|
e.releaseLocksLocked(st.ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user