We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bf1442 commit e1a3b47Copy full SHA for e1a3b47
1 file changed
src/operations/execute_operation.ts
@@ -324,17 +324,17 @@ async function executeOperationWithRetries<
324
}
325
326
if (operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError)) {
327
- if (topology.s.options.adaptiveRetries && !topology.tokenBucket.consume(RETRY_COST)) {
328
- throw error;
329
- }
330
-
331
const backoffMS = Math.random() * Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** attempt);
332
333
// if the backoff would exhaust the CSOT timeout, short-circuit.
334
if (timeoutContext.csotEnabled() && backoffMS > timeoutContext.remainingTimeMS) {
335
throw error;
336
337
+ if (topology.s.options.adaptiveRetries && !topology.tokenBucket.consume(RETRY_COST)) {
+ throw error;
+ }
+
338
await setTimeout(backoffMS);
339
340
0 commit comments