Skip to content

Commit

Permalink
fix: add retry and error handling settings to queues
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmellis committed Feb 1, 2024
1 parent 9302c11 commit 03fe4d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/queue/src/listeners/onNetworkSignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const onNetworkSignal = (network: number, callback: SignalCallback) => {

return createWorker(queueName, (job) => {
const { name, data } = job;
callback({ payload: data, type: name as any });
return callback({ payload: data, type: name as any });
});
};

Expand Down
2 changes: 1 addition & 1 deletion packages/queue/src/listeners/onSignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SignalCallback } from '../types';
const onSignal = (callback: SignalCallback) => {
return createWorker(SIGNAL_QUEUE_NAME, (job) => {
const { name, data } = job;
callback({ type: name as any, payload: data });
return callback({ type: name as any, payload: data });
});
};

Expand Down
13 changes: 12 additions & 1 deletion packages/queue/src/queues/getQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ export class NftxQueue extends Queue {
const getQueue = (queueName: string) => {
return (
NftxQueue.queues[queueName] ||
new NftxQueue(queueName, { connection: getConnection(queueName) })
new NftxQueue(queueName, {
connection: getConnection(queueName),
defaultJobOptions: {
attempts: 5,
removeOnComplete: true,
removeOnFail: true,
backoff: {
type: 'exponential',
delay: 30000,
},
},
})
);
};

Expand Down

0 comments on commit 03fe4d0

Please sign in to comment.