Skip to content

Commit

Permalink
Do not retry whole batch when a single entry fails
Browse files Browse the repository at this point in the history
We don't want to retry the _whole_ list if only a single entry fails, so
we possibly retry each entry individually, and ignore errors. Ignoring
error is not too bad anyway, the entry will be picked up again on next
lifecycle run.

Issue: BB-437
  • Loading branch information
francoisferrand committed Sep 27, 2023
1 parent b182beb commit afc0d43
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions extensions/lifecycle/tasks/LifecycleTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,18 +894,32 @@ class LifecycleTask extends BackbeatTask {
return process.nextTick(cb);
}

return async.waterfall([
next => this._getRules(bucketData, lcRules, obj, log, next),
(applicableRules, next) => {
if (versioningStatus === 'Enabled'
|| versioningStatus === 'Suspended') {
return this._compareVersion(bucketData, obj, contents,
applicableRules, versioningStatus, log, next);
}
return this._compareObject(bucketData, obj, applicableRules, log,
next);
// We don't want to retry the _whole_ list if only a single entry fails,
// so we possibly retry each individual entry here, and ignore errors.
// Ignoring error is not too bad, the entry will be picked up again on
// next lifecycle run
return this.retry({
actionDesc: 'compare rules lifecycle entry',
logFields: {
key: obj.Key,
versionId: obj.VersionId,
staleDate: obj.staleDate,
versioningStatus,
},
], cb);
actionFunc: done => async.waterfall([
next => this._getRules(bucketData, lcRules, obj, log, next),
(applicableRules, next) => {
if (versioningStatus === 'Enabled' || versioningStatus === 'Suspended') {
return this._compareVersion(bucketData, obj, contents,
applicableRules, versioningStatus, log, next);
}
return this._compareObject(bucketData, obj, applicableRules, log,
next);
},
], done),
shouldRetryFunc: err => err.retryable,
log,
}, () => cb());
}, done);
}

Expand Down

0 comments on commit afc0d43

Please sign in to comment.