From afc0d438889bb4334ae7295b6660427d1da800bb Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Sat, 23 Sep 2023 16:22:54 +0200 Subject: [PATCH] Do not retry whole batch when a single entry fails 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 --- extensions/lifecycle/tasks/LifecycleTask.js | 36 ++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/extensions/lifecycle/tasks/LifecycleTask.js b/extensions/lifecycle/tasks/LifecycleTask.js index 6e299cb1f..639ffc51c 100644 --- a/extensions/lifecycle/tasks/LifecycleTask.js +++ b/extensions/lifecycle/tasks/LifecycleTask.js @@ -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); }