-
Notifications
You must be signed in to change notification settings - Fork 593
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
Make sure OnCallbackException is executed for AsyncConsumers #946
Make sure OnCallbackException is executed for AsyncConsumers #946
Conversation
…e. Previously, the wait called only if the job hasn't done yet. It lead to missing exception and missed the invoke of OnCallbackException event.
projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs
Outdated
Show resolved
Hide resolved
projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs
Outdated
Show resolved
Hide resolved
Checking manually for exceptions with task.Exception.
object o = new object(); | ||
bool notified = false; | ||
string q = _model.QueueDeclare(); | ||
|
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.
Nit 🔥 extra line
Are you sure the tests are testing the correct thing? If I debug them, I get the exception thrown by Also if I use the tests on master, they're green with or without your changes. |
@bollhals good catch. Honestly I was a bit lazy in reviewing the tests and mostly looked at the implementation side of things. Will take extra care next time (although I confess I was just about going on leave yesterday and I think that cause me to take shortcuts) |
Copied the tests from the sync version. The task.delay(0) is just to avoid warnings (async without await in the method). |
I did some quick tests regarding performance of this change
So the currently suggested change seems like the most promising one! |
Check the received exception in the test to verify it's the same.
Thank you for sticking with it @BarShavit! |
This one can and should probably go back into 6.x |
Make sure OnCallbackException is executed for AsyncConsumers (cherry picked from commit ef8eaf4)
Backported to |
Proposed Changes
Always call to await when executing a task in AsyncConsumerWorkService. Previously, the wait called only if the job hasn't done yet. It lead to missing exception and missed the invoke of OnCallbackException event.
Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.
CONTRIBUTING.md
document