fix: to skip the operation maxRetries need to be calculated first

This commit is contained in:
Sebastian 2022-05-18 14:43:48 -03:00
parent c67d0bff1d
commit 145714b335
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -337,14 +337,6 @@ async function runTaskLoop(
let minDue: AbsoluteTime = AbsoluteTime.never();
for (const p of pending.pendingOperations) {
minDue = AbsoluteTime.min(minDue, p.timestampDue);
if (AbsoluteTime.isExpired(p.timestampDue)) {
numDue++;
}
if (p.givesLifeness) {
numGivingLiveness++;
}
const maxRetries = opts.maxRetries;
if (maxRetries && p.retryInfo && p.retryInfo.retryCounter > maxRetries) {
@ -353,6 +345,15 @@ async function runTaskLoop(
);
continue;
}
minDue = AbsoluteTime.min(minDue, p.timestampDue);
if (AbsoluteTime.isExpired(p.timestampDue)) {
numDue++;
}
if (p.givesLifeness) {
numGivingLiveness++;
}
}
if (opts.stopWhenDone && numGivingLiveness === 0 && iteration !== 0) {