Skip to content
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.

Commit

Permalink
fix: log plugin object (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
minzcmu authored Oct 22, 2018
1 parent e68fbb3 commit d5f6abf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function boot() {
multiWorker.on('job', (workerId, queue, job) =>
winston.info(`worker[${workerId}] working job ${queue} ${JSON.stringify(job)}`));
multiWorker.on('reEnqueue', (workerId, queue, job, plugin) =>
winston.info(`worker[${workerId}] reEnqueue job (${plugin}) ${queue} ${JSON.stringify(job)}`));
winston.info(`worker[${workerId}] reEnqueue job (${JSON.stringify(plugin)}) ${queue} ${JSON.stringify(job)}`));
multiWorker.on('success', (workerId, queue, job, result) =>
winston.info(`worker[${workerId}] ${job} success ${queue} ${JSON.stringify(job)} >> ${result}`));
multiWorker.on('failure', (workerId, queue, job, failure) =>
Expand Down
3 changes: 2 additions & 1 deletion lib/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const { connectionDetails, queuePrefix, runningJobsPrefix, waitingJobsPrefix }
= require('../config/redis');

const RETRY_LIMIT = 3;
const RETRY_DELAY = 5;
// This is in milliseconds, reference: https://github.com/taskrabbit/node-resque/blob/master/lib/plugins/Retry.js#L12
const RETRY_DELAY = 5 * 1000;
const redis = new Redis(connectionDetails.port, connectionDetails.host, connectionDetails.options);

const ecosystem = config.get('ecosystem');
Expand Down
3 changes: 2 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ describe('Index Test', () => {

testWorker.emit('reEnqueue', workerId, queue, job, plugin);
assert.calledWith(winstonMock.info,
`worker[${workerId}] reEnqueue job (${plugin}) ${queue} ${JSON.stringify(job)}`);
// eslint-disable-next-line max-len
`worker[${workerId}] reEnqueue job (${JSON.stringify(plugin)}) ${queue} ${JSON.stringify(job)}`);

testWorker.emit('success', workerId, queue, job, result);
assert.calledWith(winstonMock.info,
Expand Down
4 changes: 2 additions & 2 deletions test/jobs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Jobs Unit Test', () => {
pluginOptions: {
Retry: {
retryLimit: 3,
retryDelay: 5
retryDelay: 5000
},
BlockedBy: {
reenqueueWaitTime: 1,
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('Jobs Unit Test', () => {
pluginOptions: {
Retry: {
retryLimit: 3,
retryDelay: 5
retryDelay: 5000
}
},
perform: jobs.stop.perform
Expand Down

0 comments on commit d5f6abf

Please sign in to comment.