Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly initialize retry params for lifecycle #2597

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions extensions/gc/tasks/GarbageCollectorTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/conductor/LifecycleConductor.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const logIdFromType = {
* endpoint using the S3 API.
*/
class LifecycleObjectProcessor extends EventEmitter {

/**
* Constructor of LifecycleObjectProcessor
*
Expand Down Expand Up @@ -65,7 +64,7 @@ class LifecycleObjectProcessor extends EventEmitter {
transport,
}, this._log);

this.retryWrapper = new BackbeatTask();
this.retryWrapper = new BackbeatTask(this._processConfig.retry);
}

getProcessorType() {
Expand Down
3 changes: 2 additions & 1 deletion extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion extensions/lifecycle/tasks/LifecycleRequeueTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion extensions/lifecycle/tasks/LifecycleUpdateExpirationTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const BackbeatTask = require('../../../lib/tasks/BackbeatTask');
const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry');
const { LifecycleMetrics } = require('../LifecycleMetrics');
const locations = require('../../../conf/locationConfig.json') || {};
/** @typedef { import('../objectProcessor/LifecycleObjectProcessor.js') } LifecycleObjectProcessor */

class LifecycleUpdateExpirationTask extends BackbeatTask {
/**
Expand All @@ -16,7 +17,7 @@ class LifecycleUpdateExpirationTask extends BackbeatTask {
*/
constructor(proc) {
const procState = proc.getStateVars();
super();
super(procState.processConfig?.retry);
Object.assign(this, procState);
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/lifecycle/tasks/LifecycleUpdateTransitionTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand All @@ -17,7 +17,7 @@ class LifecycleUpdateTransitionTask extends BackbeatTask {
*/
constructor(proc) {
const procState = proc.getStateVars();
super();
super(procState.processConfig?.retry);
Object.assign(this, procState);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/BackbeatTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const BackOff = require('backo');
*/
class BackbeatTask {

constructor() {
this.retryParams = {
constructor(retryParams) {
this.retryParams = retryParams || {
timeoutS: 300,
backoff: {
min: 1000,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbeat",
"version": "8.6.52",
"version": "8.6.53",
"description": "Asynchronous queue and job manager",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lifecycle/LifecycleRetriggerRestoreTask.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
ProcessorMock,
} = require('../mocks');

describe('LifecycleResetTransitionInProgressTask', () => {
describe('LifecycleRetriggerRestoreTask', () => {
let backbeatMetadataProxyClient;
let objectProcessor;
let task;
Expand Down
Loading