diff --git a/extensions/gc/tasks/GarbageCollectorTask.js b/extensions/gc/tasks/GarbageCollectorTask.js index cd44cc8f2..50e6b8f06 100644 --- a/extensions/gc/tasks/GarbageCollectorTask.js +++ b/extensions/gc/tasks/GarbageCollectorTask.js @@ -5,6 +5,7 @@ const { ObjectMD } = require('arsenal').models; const { attachReqUids } = require('../../../lib/clients/utils'); const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { GarbageCollectorMetrics } = require('../GarbageCollectorMetrics'); +/** @typedef { import('../GarbageCollector.js') } GarbageCollector */ class GarbageCollectorTask extends BackbeatTask { /** @@ -14,13 +15,9 @@ class GarbageCollectorTask extends BackbeatTask { * @param {GarbageCollector} gc - garbage collector instance */ constructor(gc) { - super(); const gcState = gc.getStateVars(); + super(gcState.gcConfig?.consumer.retry); Object.assign(this, gcState); - const retryParams = gcState.gcConfig?.consumer.retry; - if (retryParams) { - this.retryParams = retryParams; - } } // helper method needed for replication generated entries in which the diff --git a/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js b/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js index 766eb461a..0ac0ec9fc 100644 --- a/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js +++ b/extensions/lifecycle/bucketProcessor/LifecycleBucketProcessor.js @@ -103,7 +103,7 @@ class LifecycleBucketProcessor { transport, }, this._log); - this.retryWrapper = new BackbeatTask(); + this.retryWrapper = new BackbeatTask(lcConfig.bucketProcessor.retry); // helper object to facilitate the tracking of the the latest x // noncurrent versions of an object when the field @@ -176,6 +176,7 @@ class LifecycleBucketProcessor { getStateVars() { return { producer: this._producer, + processConfig: this._lcConfig.bucketProcessor, bootstrapList: this._repConfig.destination.bootstrapList, bucketTasksTopic: this._lcConfig.bucketTasksTopic, objectTasksTopic: this._lcConfig.objectTasksTopic, diff --git a/extensions/lifecycle/conductor/LifecycleConductor.js b/extensions/lifecycle/conductor/LifecycleConductor.js index 685b69d40..3e8e0c3cd 100644 --- a/extensions/lifecycle/conductor/LifecycleConductor.js +++ b/extensions/lifecycle/conductor/LifecycleConductor.js @@ -577,7 +577,7 @@ class LifecycleConductor { let marker = initMarker; let nEnqueued = 0; const start = new Date(); - const retryWrapper = new BackbeatTask(); + const retryWrapper = new BackbeatTask(this.lcConfig.conductor.retry); this.lastSentId = null; this.lastSentVersion = -1; diff --git a/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js b/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js index d1e1da2c8..f40bed6fe 100644 --- a/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js +++ b/extensions/lifecycle/objectProcessor/LifecycleObjectProcessor.js @@ -22,7 +22,6 @@ const logIdFromType = { * endpoint using the S3 API. */ class LifecycleObjectProcessor extends EventEmitter { - /** * Constructor of LifecycleObjectProcessor * @@ -62,7 +61,7 @@ class LifecycleObjectProcessor extends EventEmitter { transport, }, this._log); - this.retryWrapper = new BackbeatTask(); + this.retryWrapper = new BackbeatTask(this._processConfig.retry); } getProcessorType() { diff --git a/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js b/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js index cd6d82e5f..2add7a28c 100644 --- a/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js +++ b/extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js @@ -5,6 +5,7 @@ const ObjectMD = require('arsenal').models.ObjectMD; const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { attachReqUids } = require('../../../lib/clients/utils'); const { LifecycleMetrics } = require('../LifecycleMetrics'); +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class ObjectLockedError extends Error {} class PendingReplicationError extends Error {} @@ -18,7 +19,7 @@ class LifecycleDeleteObjectTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); this.objectMD = null; } diff --git a/extensions/lifecycle/tasks/LifecycleRequeueTask.js b/extensions/lifecycle/tasks/LifecycleRequeueTask.js index 64615a84d..5a6a8dbb9 100644 --- a/extensions/lifecycle/tasks/LifecycleRequeueTask.js +++ b/extensions/lifecycle/tasks/LifecycleRequeueTask.js @@ -7,6 +7,7 @@ const ObjectMD = require('arsenal').models.ObjectMD; const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const { LifecycleMetrics } = require('../LifecycleMetrics'); +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleRequeueTask extends BackbeatTask { @@ -19,7 +20,7 @@ class LifecycleRequeueTask extends BackbeatTask { */ constructor(proc, processName) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); this.processName = processName; } diff --git a/extensions/lifecycle/tasks/LifecycleTask.js b/extensions/lifecycle/tasks/LifecycleTask.js index 41316571c..4a454d122 100644 --- a/extensions/lifecycle/tasks/LifecycleTask.js +++ b/extensions/lifecycle/tasks/LifecycleTask.js @@ -85,7 +85,7 @@ class LifecycleTask extends BackbeatTask { */ constructor(lp) { const lpState = lp.getStateVars(); - super(); + super(lpState.processConfig?.retry); Object.assign(this, lpState); const { transitionOneDayEarlier, expireOneDayEarlier, timeProgressionFactor } = this.lcOptions; diff --git a/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js b/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js index f3fe2c9f7..b8939e954 100644 --- a/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js +++ b/extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js @@ -5,6 +5,7 @@ const ObjectMD = require('arsenal').models.ObjectMD; const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); const { LifecycleMetrics } = require('../LifecycleMetrics'); +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleUpdateExpirationTask extends BackbeatTask { /** @@ -15,7 +16,7 @@ class LifecycleUpdateExpirationTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); } diff --git a/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js b/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js index 5253a17b9..33d43eaca 100644 --- a/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js +++ b/extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js @@ -6,7 +6,7 @@ const BackbeatTask = require('../../../lib/tasks/BackbeatTask'); const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry'); const ObjectMD = require('arsenal').models.ObjectMD; const { LifecycleMetrics } = require('../LifecycleMetrics'); - +/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */ class LifecycleUpdateTransitionTask extends BackbeatTask { /** @@ -17,7 +17,7 @@ class LifecycleUpdateTransitionTask extends BackbeatTask { */ constructor(proc) { const procState = proc.getStateVars(); - super(); + super(procState.processConfig?.retry); Object.assign(this, procState); } diff --git a/lib/tasks/BackbeatTask.js b/lib/tasks/BackbeatTask.js index 64fe9f531..1352bfb2a 100644 --- a/lib/tasks/BackbeatTask.js +++ b/lib/tasks/BackbeatTask.js @@ -5,8 +5,8 @@ const BackOff = require('backo'); */ class BackbeatTask { - constructor() { - this.retryParams = { + constructor(retryParams) { + this.retryParams = retryParams || { timeoutS: 300, backoff: { min: 1000, diff --git a/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js b/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js index 3f72d9e62..e470bb6d4 100644 --- a/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js +++ b/tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js @@ -11,7 +11,7 @@ const { ProcessorMock, } = require('../mocks'); -describe('LifecycleResetTransitionInProgressTask', () => { +describe('LifecycleRetriggerRestoreTask', () => { let backbeatMetadataProxyClient; let objectProcessor; let task;