Skip to content

Commit 0281edc

Browse files
cursoragentComposer
andcommitted
fix(watcher): add delay on success path to prevent busy loop
When RetryWatcher's result channel closes without an error (e.g., after exhausting internal retries), the outer loop retried immediately with no delay, causing high CPU usage. Restore 1-second cooldown on success path to match previous behavior and prevent reconnection storms. Co-Authored-By: Composer <noreply@cursor.com>
1 parent f0b8710 commit 0281edc

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

internal/agent/watcher_events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func watchEventsInNamespaceForever(ctx context.Context, config *rest.Config, nam
252252
time.Sleep(b.duration())
253253
} else {
254254
b.reset()
255+
time.Sleep(time.Second)
255256
}
256257
watchSince = time.Now()
257258
}

internal/agent/watcher_pods.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ func watchPodsInNamespaceForever(ctx context.Context, config *rest.Config, names
207207
time.Sleep(b.duration())
208208
} else {
209209
b.reset()
210+
time.Sleep(time.Second)
210211
}
211212
}
212213
}

0 commit comments

Comments
 (0)