Repository navigation
Conversation
When spring.cloud.config.server.git.refresh-rate is set, the config server does not fetch from the remote until the refresh rate has elapsed. A webhook sent to /monitor notifies the applications, which then fetch their configuration from the config server, but the config server may still serve the previous commit to them. Add JGitEnvironmentRepository#expireRefreshRate, which makes the next request fetch from the remote. MultipleJGitEnvironmentRepository also expires the repositories it manages. PropertyPathEndpoint expires the refresh rate of the config server's Git repositories before notifying the affected applications. Fixes spring-cloudgh-2249 Signed-off-by: DDINGJOO <173995233+DDINGJOO@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2249
When
spring.cloud.config.server.git.refresh-rateis set, the config server doesn't fetch from the remote until the refresh rate has elapsed. A webhook sent to/monitornotifies the applications, which then fetch their configuration from the config server, but the config server may still serve them the previous commit.Following the direction in the issue (the config server should learn that a repository changed and expire its refresh rate), this PR:
JGitEnvironmentRepository#expireRefreshRate(), which makes the next request fetch from the remote. A negative refresh rate (never fetch) is unchanged.MultipleJGitEnvironmentRepositoryto also expire the pattern-matching repositories and the repositories created for URI placeholders.PropertyPathEndpointexpire the refresh rate of the config server's Git repositories before notifying the affected applications. Notifications that affect no application, for example because all paths are ignored, don't expire anything.EnvironmentMonitorAutoConfigurationpasses theJGitEnvironmentRepositorybeans to the endpoint; the existing constructors keep working and pass none.I first considered doing this with a
PropertyPathNotifier, but an always-present notifier would defeat the "At least one PropertyPathNotifier must be available" check, so the endpoint does it directly.This doesn't add a new way to make the server hit the Git server. It only lets the refresh that
/monitoralready triggers actually fetch, at most once per notification, and the existing webhook validators still apply.Tests:
JGitEnvironmentRepositoryIntegrationTests: with a 60 second refresh rate, a new commit on the remote is not served within the window, and is served afterexpireRefreshRate().MultipleJGitEnvironmentRepositoryTests: expiring also expires the managed repositories.PropertyPathEndpointTests: the refresh rate is already expired when the notifiers run, and is left untouched when no service is affected.