-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
fix(microservice/kafka): properly await disconnect promises #5422
Conversation
Pull Request Test Coverage Report for Build f718f40f-aed9-43b6-b04e-4fedcc01b884
💛 - Coveralls |
@jmcdo29 - should be good now, thank you. |
This LGTM! It is rather important to wait for the disconnect to occur so it ensures the brokers know that the consumer has disconnected. |
`producer.disconnect()` and `consumer.disconnect()` are promises. Since they weren't being `await`ed properly, you would have Kafka code that would attempt to execute after teardown. By waiting for the promises, those errors go away. Official documentation: https://kafka.js.org/docs/getting-started Closes #4830
@jmcdo29 @kamilmysliwiec any chance this can be looked at / merged? This is a real problem when testing since connections are not properly being disconnected. |
Changes look good to me. I don't think it would be a problem to merge. We'll wait to hear from Kamil though 😸 |
producer.disconnect()
andconsumer.disconnect()
are promises.Since they weren't being
await
ed properly, you would have Kafka code thatwould attempt to execute after teardown. By waiting for the promises, those errors
go away.
Official documentation: https://kafka.js.org/docs/getting-started
Closes #4830
Here are tests from KafkaJS showing those methods as async
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Tests with kafka do not get torn down properly
Issue Number: #4830
What is the new behavior?
Promises are handled properly and no code is executed after teardown.
Does this PR introduce a breaking change?
Maybe? People will have to
await
their promises if they weren't alreadyOther information