mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 22:09:37 +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
|
||||
}
|
||||
}
|
||||
// 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" {
|
||||
e.releaseLocksLocked(st.ID)
|
||||
|
||||
Reference in New Issue
Block a user