Skip to content

Commit

Permalink
Merge branch 'improvement/BB-635' into w/9.0/improvement/BB-635
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisferrand committed Dec 3, 2024
2 parents fbc8f83 + ac883ef commit cca038a
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
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 @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const logIdFromType = {
* endpoint using the S3 API.
*/
class LifecycleObjectProcessor extends EventEmitter {

/**
* Constructor of LifecycleObjectProcessor
*
Expand Down Expand Up @@ -62,7 +61,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 @@ -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 {
/**
Expand All @@ -15,7 +16,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 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

0 comments on commit cca038a

Please sign in to comment.