Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

380
Views
How to run cron job every minute in Queue using Workers with bullmq package in nodejs?
    import { Queue, Worker, Job } from 'bullmq';

const myQueue = new Queue('firstjob', { connection: redis });
    import { autorunJobs } from './processes/job.process';
    
async function addQueue() {
    await myQueue.add(
        'autoclosejob',
        {
            repeat: {
                cron: '* * * * *'
            },
        },
    );
}

addQueue();

const worker = new Worker('firstjob', async (job: Job) => {
    console.info('Started.');
   await autorunJobs();
    console.info('Closed.');
    //return true;
}, { connection: redis });
worker.run();

When I run this code, it executes successfully at once. But after I wait for the worker to run it again in the next minute but it doesn't. What I see is only one-time console.log output.

Following are one-time output logs:

Tue, 10 May 2022 12:21:12 GMT | IDM Service | INFO |    Started.
dta = "some data"
Tue, 10 May 2022 12:21:12 GMT | IDM Service | INFO |      Closed.

I want this output after every minute.

What I am doing wrong?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!