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

Using the "prefix" option #560

Closed
denvolok opened this issue May 21, 2021 · 3 comments
Closed

Using the "prefix" option #560

denvolok opened this issue May 21, 2021 · 3 comments

Comments

@denvolok
Copy link

  const connection = new Redis(6389);
  const queue = new Queue('foo', { connection, prefix: "PF" });

  new Worker('foo', (job)=>{
      return 'bar';
  }, { connection })

  queue.add('foo', {});

Redis keys created:

1) "PF:foo:id"
2) "PF:foo:meta"
3) "PF:foo:wait"
4) "bull:foo:events"
5) "PF:foo:1"
6) "PF:foo:events"
  1. Is it expected to have some keys not prefixed?
  2. Also, the job in this case is not processed (waiting). Works without the "prefix" option.

bullmq version - 1.26.5

@manast manast added the bug Something isn't working label May 24, 2021
@manast
Copy link
Contributor

manast commented May 24, 2021

that is definitely a bug, thanks for reporting it.

@denvolok
Copy link
Author

denvolok commented May 25, 2021

@manast investigated the problem a bit. All core classes - Worker, QueueScheduler, QueueEvents extend QueueBase, which have the following code in the constructor:

    this.opts = {
      prefix: 'bull',
      ...opts,
    };

So, if we don't specify "prefix" option for this classes - "bull" will be used.
Seems like "prefix" should be synced somehow between all classes.

As a workaround we can specify the same prefix for all core classes instances

@manast
Copy link
Contributor

manast commented May 25, 2021

ah ok, I missed that you did not specify the prefix on the Worker class, then it works as expected.

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

No branches or pull requests

2 participants