-
Notifications
You must be signed in to change notification settings - Fork 107
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
Wait for drain when publish/sendToQueue returns false #129
Comments
drain
when publish
/sendToQueue
returns false
drain
when publish
/sendToQueue
returns false
The same goes for
Directly attaching event listener using ConfirmChannel inside |
Any update on channel drain event? I can see the drain event being fired but no messages are getting dropped. Not sure, whether it is handled in this library. I can't find the code where drain is handled |
Reading the code if you always //This will work fine because the internal setImmediate call will throttle your publishes to 1 per event loop cycle.
for (let index = 0; index < 500000; index++) {
await channel.publish(exchange, topic, Buffer.from("yourmessage"+index)
}
//This will bust hard!
for (let index = 0; index < 5000000; index++) {
channel..publish(exchange, topic, Buffer.from("yourmessage"+index)
} I might open a PR to fix or I might just purge this library from our code base largely dependent on if its maintainer responds. |
I am more than happy to accept a PR. |
## [3.2.3](v3.2.2...v3.2.3) (2021-08-21) ### Bug Fixes * fixed issue with publish ignoring 'drain' event ([e195d9b](e195d9b)), closes [#129](#129)
🎉 This issue has been resolved in version 3.2.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I am trying to read through the code and I know for a fact I have not seen any waits for the
drain
event formchannel
, however, I am not sure if they are needed.According to the
amqplib
docs, whenpublish
orsendToQueue
returnsfalse
, you should wait for thedrain
event before re-trying. It looks like the code currently just returns false and leaves it to the user to retry; but that requires accessingchannelWrapper._channel.on('drain', cb)
to do so.You can find the docs on this at the bottom of this section.
The text was updated successfully, but these errors were encountered: