-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Add support for bullmq (bull v4) and some small improvements #49
Conversation
index.js
Outdated
}) | ||
|
||
return queues | ||
}, | ||
createQueues: redis => { | ||
if (isBullMQ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been actually considering removing the option to createQueues
and keep only setQueues
, what do you think?
this way we can keep the lib easier to maintain! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Make sense, I'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realize that it was the only place where we needed to require('bull')
. It means that we can remove bull and bullmq from peerDependencies, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! exactly, this way we don't need to control the lib version or anything, leaving it only up to the users and making sure we support the correct versions 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some testing, I saw that some functions have changed signature between Bull3 and BullMQ...
I can detect the version of a queue by checking (for example) if the drain
method exists (BullMQ) or not (Bull3). This way, we can switch if needed...
For example, queue.clean
has not the same signature:
// With BullMQ
await queue.clean(GRACE_TIME_MS, LIMIT, queueStatus)
// With Bull3
await queue.clean(GRACE_TIME_MS, queueStatus)
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's tricky 😅
I would say we can have some check when constructing the lib, and have that variable in the locals, I guess it will be a consequence to have some conditions in some places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a map to store the version for each queue (this way a system can have both versions simultaneously). The function that check the bull version is here
that is amazing @Embraser01! thank you very much for this PR I added only one minor comment, but other than that I think it's fine! But I guess this would be enough for a 1.0 release, and for that I want to improve some other things in the lib, so I'll probably merge soon and hold the release to include more stuff |
Unsolicited suggestion, but could you add the v4 docs (https://docs.bullmq.io) to the README in this PR? Might be helpful for new users who are starting with v4. Bull's docs are referenced here |
no problems @ericcarboni! @Embraser01 can you add it please? at least some basic stuff, I'll make sure the docs are improved as much as possible before bumping to v1.0.0 |
I think this PR is getting in great shape to be merged! |
thanks for the awesome work @Embraser01! I have a |
Did this get published to NPM? |
No, not yet 😅 I’m preparing a 1.0 launch, I’ll probably release a beta version so if you would like to try it out please follow the pr #51! |
Hi,
I added support for bull v4 (#38).
createQueues
function does not support bull 4Unrelated (I can move it to another PR if you want), I added a button to toggle data instead of displaying it directly. In case of big data blob, the UI was freezing
closes #32
closes #38