-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
#1294 Fix the problem while doing first call for service in PollConsul provider #1562
Conversation
@TomPallister could you have a look? :) |
Hi @TomPallister , could you please have a look? :) |
Hi Przemyslaw! Don't forget to update your feature branch by latest top-commits from base:develop branch! |
Przemyslaw! Or go to my forked Ocelot repo. And it says: "This branch is up to date with ThreeMammals/Ocelot:develop." Do you have an intention to have some pair programming? |
f602132
to
3888154
Compare
@przemyslawandruszewski Przemyslaw, Good luck during code review! |
@chaitanyaphanikumar @lufeiyuan83 @ggnaegi |
} | ||
|
||
private async Task Poll() | ||
{ | ||
_services = await _consulServiceDiscoveryProvider.Get(); |
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.
The "Poll" method mixes 2 things: getting services and caching. I think that respecting the principle of single responsibility, and putting caching in the main "Get" method, would make the code more readable.
Going further, is the "Poll" method really useful?
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.
Ray, is caching a good functionality at all in the provider?
Yes, it is addressed, but this PR has extra enhancement of injecting IMemoryCache object into |
Like @RaynaldM I think, we are mixing concerns here... |
@ggnaegi By other words, if we remove caching logic here, this PR become duplicate of yours, right? Yes, it seems caching inside of provider is bad idea. The provider should communicate to Consul service only. |
@przemyslawandruszewski Again, Thanks you for the PR! |
Duplicate of #1670 |
Fixes #1294
Fix for
PollConsul
provider for the first request to any service while API gateway usesPollConsul
provider.Proposed Changes