Skip to content

Commit 96e16d7

Browse files
authored
sleep longer and more when code searching (github#24385)
* sleep longer and more when code searching * exponential
1 parent acc178e commit 96e16d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

script/helpers/git-utils.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async function searchCode(q, perPage, currentPage) {
170170
}
171171
}
172172

173-
async function secondaryRateLimitRetry(callable, args, maxAttempts = 5) {
173+
async function secondaryRateLimitRetry(callable, args, maxAttempts = 10, sleepTime = 1000) {
174174
try {
175175
const response = await callable(args)
176176
return response
@@ -185,7 +185,6 @@ async function secondaryRateLimitRetry(callable, args, maxAttempts = 5) {
185185
//
186186
// Let's look for that an manually self-recurse, under certain conditions
187187
const lookFor = 'You have exceeded a secondary rate limit.'
188-
const sleepTime = 5000 // ms
189188
if (
190189
err.status &&
191190
err.status === 403 &&
@@ -199,7 +198,7 @@ async function secondaryRateLimitRetry(callable, args, maxAttempts = 5) {
199198
)
200199
return new Promise((resolve) => {
201200
setTimeout(() => {
202-
resolve(secondaryRateLimitRetry(callable, args, maxAttempts - 1))
201+
resolve(secondaryRateLimitRetry(callable, args, maxAttempts - 1, sleepTime * 2))
203202
}, sleepTime)
204203
})
205204
}

0 commit comments

Comments
 (0)