From eeda785b542489a44624ca836c42efe0bdeb6cd1 Mon Sep 17 00:00:00 2001 From: Tom Bedor Date: Wed, 26 Feb 2025 14:51:35 -0800 Subject: [PATCH] Update exponential backoff to retry faster https://github.com/RooVetGit/Roo-Code/issues/850 Old backoff: 5 10 20 40 80 New backoff: - First 3 attempts: 5 second delay - 4th attempt: ~5.06 second delay - 5th attempt: ~7.59 second delay - 6th attempt: ~11.39 second delay --- src/core/Cline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 2e29ad453c..33bcbe0fef 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1012,7 +1012,7 @@ export class Cline { if (alwaysApproveResubmit) { const errorMsg = error.error?.metadata?.raw ?? error.message ?? "Unknown error" const baseDelay = requestDelaySeconds || 5 - const exponentialDelay = Math.ceil(baseDelay * Math.pow(2, retryAttempt)) + const exponentialDelay = Math.max(baseDelay, Math.pow(1.5, retryAttempt)) // Wait for the greater of the exponential delay or the rate limit delay const finalDelay = Math.max(exponentialDelay, rateLimitDelay)