fix: create fresh context per watermark write retry attempt
Each retry in the SetOutboxWatermark loop now gets its own 5s context. Previously a shared context could already be expired when the second or third attempt ran, making the retries pointless. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,11 +264,11 @@ func (s *SchedulerSnapshotService) pollOutbox() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastID := events[len(events)-1].ID
|
lastID := events[len(events)-1].ID
|
||||||
wmCtx, wmCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
||||||
defer wmCancel()
|
|
||||||
var wmErr error
|
var wmErr error
|
||||||
for i := range 3 {
|
for i := range 3 {
|
||||||
|
wmCtx, wmCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
wmErr = s.cache.SetOutboxWatermark(wmCtx, lastID)
|
wmErr = s.cache.SetOutboxWatermark(wmCtx, lastID)
|
||||||
|
wmCancel()
|
||||||
if wmErr == nil {
|
if wmErr == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user