-
Notifications
You must be signed in to change notification settings - Fork 144
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: Changing all middlewares to use asynchronous policy execution. (fixes #232) #235
Conversation
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.
@videege thank you for this. I tend to avoid GetAwaiter().GetResult()
, see comments.
@@ -31,7 +31,7 @@ public BasicPublishMiddleware(IExclusiveLock exclusive, BasicPublishOptions opti | |||
[RetryKey.PublishMandatory] = mandatory, | |||
[RetryKey.BasicProperties] = basicProps, | |||
[RetryKey.PublishBody] = body, | |||
}); | |||
}).GetAwaiter().GetResult(); |
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.
Since we're planning to go all in, I think we should make the call to this method async. That way, we get rid of the .GetAwaiter().GetResult()
. Makes sense?
{ | ||
policyName = policyName ?? PolicyKeys.DefaultPolicy; | ||
context.Properties.TryAdd(policyName, poliocy); | ||
context.Properties.TryAdd(policyName, policy); |
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.
👌
contextData: new Dictionary<string, object> | ||
{ | ||
[RetryKey.PipeContext] = context | ||
}); | ||
}).GetAwaiter().GetResult(); |
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 think this method should be async
I agree with your comments - I'll take a look at updating the PR tonight. |
…unctions to avoid the use of GetAwaiter().
I pushed a change making everything async - what do you think? |
Looks good! Thanks! |
Any chance you could push a package release including this fix? ping @pardahlman |
Description
This changes the Polly enricher to use asynchronous policy execution. (fixes #232)
Note: I wasn't sure the best way to do this, but you might want to add some kind of detection in to reject the registration of synchronous policies, or add it to the docs.
Check List
stable
branch.