Repository navigation
perf: cache getConfig - #9377
Merged
Merged
Conversation
jrasm91
reviewed
May 10, 2024
jrasm91
left a comment
Member
There was a problem hiding this comment.
Did you test changing config at runtime and verifying the microservices uses the new config? Specifically for stuff like storage template migration and concurrency?
Member
Author
|
Yep. I ran thumbnail generation and changed the preview format midway. The success logs immediately started using the new format. |
danieldietzler
approved these changes
May 10, 2024
Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
Deploying immich with
|
| Latest commit: |
f68d5bc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0671f7ec.immich.pages.dev |
| Branch Preview URL: | https://perf-cache-get-config.immich.pages.dev |
Member
Those don't use config$ though |
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.
Description
When not using a config file, we currently fetch the config on each call. This adds up to quite a few unnecessary queries since this method is called so frequently. Even when using a config file, we apply the same overrides and re-validate the same resulting object each time. This PR caches the config object, only updating it when a config update event is triggered.
How Has This Been Tested
Tested that jobs process as normal with and without a config file, that updating the config through the web UI updates the config object, and that multiple concurrent calls to
getConfigresult in only one query.