Skip to content
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

Consul cache background update #21

Merged
merged 8 commits into from
Nov 21, 2023
Merged

Consul cache background update #21

merged 8 commits into from
Nov 21, 2023

Conversation

muphblu
Copy link
Contributor

@muphblu muphblu commented Nov 14, 2023

Summary

Fixes long wait time for resolving address using ConsulServiceAddress in some situations.
Added metrics for consul request.

Details

In situations when Consul response time increases:
Previously ConsulServiceAddress awaited consul for response if cache update is in process. It produced situation when all request to other service were blocked until Consul response returned. Situation repeats each cache update(default 5 sec).
Cache clears itself in case of error response from consul, next requests will be resolved with error "Не удалось взять настройки из консула для service:environment", until success cache update occures.

Now ConsulServiceAddress always resolves service address from cache. Warning: Cache will not be changed in case consul returns error response, next requests use potentially outdated cache.

ATI.Services.Consul/ConsulAdapter.cs Outdated Show resolved Hide resolved
ATI.Services.Consul/ConsulAdapter.cs Outdated Show resolved Hide resolved
ATI.Services.Consul/ConsulServiceAddressCache.cs Outdated Show resolved Hide resolved
@muphblu muphblu merged commit 89a6a62 into master Nov 21, 2023
2 checks passed
@muphblu muphblu deleted the consul-cache-bckg-update branch November 21, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants