2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-07 06:32:00 +08:00

Update heartbeat goroutine to call ExtendLease on active tasks

This commit is contained in:
Ken Hibino
2022-02-12 09:48:07 -08:00
parent 87dc392c7f
commit 871474f220
6 changed files with 215 additions and 26 deletions

View File

@@ -163,6 +163,15 @@ func (tb *TestBroker) ListLeaseExpired(cutoff time.Time, qnames ...string) ([]*b
return tb.real.ListLeaseExpired(cutoff, qnames...)
}
func (tb *TestBroker) ExtendLease(qname string, ids ...string) error {
tb.mu.Lock()
defer tb.mu.Unlock()
if tb.sleeping {
return errRedisDown
}
return tb.real.ExtendLease(qname, ids...)
}
func (tb *TestBroker) WriteServerState(info *base.ServerInfo, workers []*base.WorkerInfo, ttl time.Duration) error {
tb.mu.Lock()
defer tb.mu.Unlock()