-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
perf: cache getConfig
#9377
perf: cache getConfig
#9377
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.
Did you test changing config at runtime and verifying the microservices uses the new config? Specifically for stuff like storage template migration and concurrency?
Yep. I ran thumbnail generation and changed the preview format midway. The success logs immediately started using the new format. |
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.
LGTM :)
Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
Deploying immich with Cloudflare Pages
|
Those don't use config$ though |
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
getConfig
result in only one query.