Skip to content

Commit

Permalink
Merge pull request #131 from TogetherCrew/130-cronjob-exceeds-default…
Browse files Browse the repository at this point in the history
…-time-limit-in-bullmq-resulting-in-unwanted-retries

[FIXBUG]: increase the queue job time limit
  • Loading branch information
cyri113 authored Oct 25, 2023
2 parents 4164c0b + 6bda216 commit 5c98e64
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const client = new Client({

const partial =
(func: any, ...args: any) =>

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 39 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
(...rest: any) =>
func(...args, ...rest);
(...rest: any) =>

Check warning on line 40 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
func(...args, ...rest);

const fetchMethod = async (msg: any) => {

Check warning on line 43 in src/index.ts

View workflow job for this annotation

GitHub Actions / test/node 18.x/ubuntu-latest

Unexpected any. Specify a different type
logger.info({ msg }, 'fetchMethod is running');
Expand Down Expand Up @@ -170,20 +170,19 @@ async function app() {
host: config.redis.host,
port: config.redis.port,
password: config.redis.password,
},
}
});
queue.add('cronJob', {}, {
repeat: {
cron: '0 0 * * *', // Run once 00:00 UTC
// cron: '* * * * *', // Run every minute
// every: 10000
},
jobId: 'cronJob', // Optional: Provide a unique ID for the job
attempts: 0, // Number of times to retry the job if it fails
backoff: {
type: 'exponential',
delay: 1000, // Initial delay between retries in milliseconds
},

} as never);

// Create a worker to process the job
Expand All @@ -202,6 +201,7 @@ async function app() {
port: config.redis.port,
password: config.redis.password,
},
lockDuration: 7200000, // 2 hour
}
);

Expand Down

0 comments on commit 5c98e64

Please sign in to comment.