Open cnwangjie opened 2 years ago
You should not use ioredis prefix as it is making some magic with keys and BullMQ handles prefixes on its own. Maybe we should throw an exception if this setting is set.
Hi, @manast
Thank you for your reply. Whether sharing the Redis client instance with others' usage is by design or not? If not, why bullmq allowed to pass a redis instance directly?
@cnwangjie so that you can save Redis connections, some users have a limited amount of connections to use.
@manast Yes, I also hope to save connections. Even use one Redis instance for multiple projects. It would be great if Redis keyPrefix
option could be supported.
I guess we can get options from redis client instance for a simple implementation.
I also wished we could support it, but unfortunately, it is very very complicated to do, sorry. Best we can do is throw an error, if the keyPrefix is used by mistake.
Should users simply prefix queue names new Queue(prefix + '_jobs')
if two applications need to use the same redis instance?
You can use different queue names or use the prefix option: https://api.docs.bullmq.io/interfaces/QueueOptions.html#prefix
You can use different queue names or use the prefix option: https://api.docs.bullmq.io/interfaces/QueueOptions.html#prefix
Thanks. I presume there's no way to globally provide this?
No, you need to specify it in every Queue and Worker instance.
Best we can do is throw an error, if the keyPrefix is used by mistake.
Please add that :pray: also for the connection option, I just spend more than a hour tracking down why the jobs were getting stalled when they should not. And it was because of the keyPrefix :face_exhaling:
I specified the
keyPrefix
to redis option. Then whenever I specify the prefix or not on bullmq option it will not work.I found a similar issue for that (#560). I can understand that I need to provide the same prefix option on the Queue and the Worker, but what about on I provide keyPrefix on redis option?