Refactor AssetSources to be thread-safe#10301
Merged
mitchellhenke merged 3 commits intomainfrom Mar 25, 2024
Merged
Conversation
mitchellhenke
commented
Mar 25, 2024
lib/asset_sources.rb
Outdated
Contributor
Author
There was a problem hiding this comment.
This is a slight change in behavior to avoid changing the values of the instance outside of instantiation when caching is enabled
added 2 commits
March 25, 2024 12:26
changelog: Internal, Performance, Refactor AssetSources class to be thread-safe
13ac05b to
8fd5e53
Compare
zachmargolis
approved these changes
Mar 25, 2024
Contributor
zachmargolis
left a comment
There was a problem hiding this comment.
but of teeny little things but LGTM! none of them showstoppers
38c5c7c to
31a899c
Compare
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
31a899c to
53d2123
Compare
aduth
reviewed
Mar 25, 2024
| def initialize(manifest_path:, cache_manifest:, i18n_locales:) | ||
| @manifest_path = manifest_path | ||
| @cache_manifest = cache_manifest | ||
| @regexp_locale_suffix = %r{\.(#{i18n_locales.join('|')})\.js$} |
Contributor
There was a problem hiding this comment.
Might be a decent microoptimization to avoid creating this pattern every time we call get_sources 👍
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.
🛠 Summary of changes
AssetSourcesis currently initialized on boot and not modified afterwards (unless in development). The issue is it's use of the instance variable in class method. This PR refactors them out to be instance variables on an instance of the class that is assigned to the application configuration.(Somewhat related to #10300)