Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeatable jobs not starting #1404

Closed
EmanuelCampos opened this issue Sep 6, 2022 · 4 comments
Closed

repeatable jobs not starting #1404

EmanuelCampos opened this issue Sep 6, 2022 · 4 comments

Comments

@EmanuelCampos
Copy link

Hello guys, I'm trying to start some repeatable jobs, but it's only being completed one time and stopping later:

my setup:

jobs.ts

export const queue = new Queue("named", {
  connection,
});
const myQueueScheduler = new QueueScheduler("named", { connection });

endpoint.ts

const id = "123"

await queue.add(JOBS.NAME_HERE,
    {
      id,
    },
    { 
      repeat: { 
        every: 5000, 
        limit: 70
      }
    }
);

app.ts

const worker = new Worker(
   "named",
   async (job) => {
     switch (job.name) {
       case JOBS.NAME_HERE: {
         return await doSomething(job.data.id);
       }
       case JOBS.NAME_HERE_2: {
         return await doSomething2(job.data.id);
       }
     }
   },
   { connection }
);
@manast
Copy link
Contributor

manast commented Sep 6, 2022

Works for me.

const { Queue, Worker, QueueScheduler } = require("bullmq");

const connection = {
  host: "localhost",
  port: 6379,
};

const queue = new Queue("named", {
  connection,
});
const myQueueScheduler = new QueueScheduler("named", { connection });

const id = "123";

queue.add(
  "test",
  {
    id,
  },
  {
    repeat: {
      every: 5000,
      limit: 70,
    },
  }
);

const worker = new Worker(
  "named",
  async (job) => {
    console.log("job", job.data.id);
  },
  { connection }
);

Results:

node 1404.js
job 123
job 123
job 123
job 123
job 123
job 123
job 123
job 123
job 123

@atakangah
Copy link

Is there no documentation on how to start repeatable jobs in v2?

@EmanuelCampos
Copy link
Author

Is there no documentation on how to start repeatable jobs in v2?

https://docs.bullmq.io/guide/jobs/repeatable#repeatable

@EmanuelCampos
Copy link
Author

issue closed, I changed the way that I was calling the worker, and works well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants