File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ import { ApiMessage } from "../task-persistence/apiMessages"
8686import { getMessagesSinceLastSummary , summarizeConversation } from "../condense"
8787import { maybeRemoveImageBlocks } from "../../api/transform/image-cleaning"
8888
89+ // Constants
90+ const MAX_EXPONENTIAL_BACKOFF_SECONDS = 600 // 10 minutes
91+
8992export type ClineEvents = {
9093 message : [ { action : "created" | "updated" ; message : ClineMessage } ]
9194 taskStarted : [ ]
@@ -1799,7 +1802,10 @@ export class Task extends EventEmitter<ClineEvents> {
17991802 }
18001803
18011804 const baseDelay = requestDelaySeconds || 5
1802- let exponentialDelay = Math . ceil ( baseDelay * Math . pow ( 2 , retryAttempt ) )
1805+ let exponentialDelay = Math . min (
1806+ Math . ceil ( baseDelay * Math . pow ( 2 , retryAttempt ) ) ,
1807+ MAX_EXPONENTIAL_BACKOFF_SECONDS ,
1808+ )
18031809
18041810 // If the error is a 429, and the error details contain a retry delay, use that delay instead of exponential backoff
18051811 if ( error . status === 429 ) {
You can’t perform that action at this time.
0 commit comments