Commit afb67d77 authored by Elysia's avatar Elysia Committed by 陈曦
Browse files

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: default avatarClaude Sonnet 4.6 (1M context) <noreply@anthropic.com>
parent 560cdad7
...@@ -264,11 +264,11 @@ func (s *SchedulerSnapshotService) pollOutbox() { ...@@ -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
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment