arena icon indicating copy to clipboard operation
arena copied to clipboard

Ability to pass Queue instance instead of constructor + options in config

Open bogdan opened this issue 5 years ago • 0 comments

Our queues have some advanced configuration like:

export const MailerQueue = new Queue<{
  name: Name;
  params: Serializable;
}>('MailerQueue', {
  limiter: {
    max: 100,
    duration: 5 * 1000,
  },
  defaultJobOptions: {
    attempts: 3,
    backoff: 60 * 1000,
  },
);

All of that configuration is lost when job is made via this tool.

It can be fixed by introducing the ability to pass a Queue instance as the configuration options instead of constructor + config, like:

const arena = Arena(
  {
    queues: [MailerQueue],
  },
);

instead of:

const arent = Arena({
queues: {
  hostId: 'main',
  name: "MailerQueue",
  url: config.REDIS_URL,
  type: 'bull',
},
Bull: Queue,
});

Are you open for a PR with such a feature?

bogdan avatar Jan 11 '21 14:01 bogdan