adonis-bull icon indicating copy to clipboard operation
adonis-bull copied to clipboard

Queue Limiter Not Working

Open dmillerSHQ opened this issue 4 years ago • 1 comments

I have a process that adds a single item to the queue and it works perfectly.

I have another process that adds 10 items to the queue, but they all process at the same time, I was expecting 1 at a time but can't get this process to work like this. What am I missing?

Working Code:

async handle (args, options) {
  // get env
  const appEnv = Config.get("app.environment");

  // get company id from cli argument
  const clientID = args.company;

  // Data to be passed to job handle
  const data = {
    id: clientID
  };
  this.info(`Queueing ${clientID} Job in ${appEnv}`);

  await Bull.add(Job.key, {
    id: clientID
  });

  this.info("Job Queued");

  process.exit();
}

If I modify that script and add the following, all 3 will process immediately, is there any way to change this?

await Bull.add(Job.key,{
  id: 1
});

await Bull.add(Job.key,{
  id: 2
});

await Bull.add(Job.key,{
  id: 3
});

dmillerSHQ avatar Nov 03 '20 16:11 dmillerSHQ

I've run some tests and they were in sequential.

Did you change anything in the default options?

HigoRibeiro avatar Jan 19 '21 12:01 HigoRibeiro