Repository navigation
Skip the background notifications fetch while the cache is fresh - #9046
Open
hasandenizuk wants to merge 1 commit into
Open
hasandenizuk wants to merge 1 commit into
hasandenizuk wants to merge 1 commit into
Conversation
Author
|
I have signed the CLA! |
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.
WHY are these changes introduced?
After every command, the prerun hook starts
shopify notifications list --ignore-errorsas a detached process. That process boots the whole CLI again: on CLI 5.0.0 it takes about 2.4 s and 2.5 to 3 s of CPU, more than a short command likeshopify version(about 1.4 s of CPU). Scripts that run many short commands, for example a loop ofshopify store executecalls, pay this on every call, and in parallel runs these background processes take the CPU the real calls need.WHAT is this pull request doing?
fetchNotificationsInBackgroundnow reads the timestamp the notifications cache already stores, and skips the background fetch when the cached list is less than an hour old. After an hour, or with an empty cache, it fetches as before. Two unit tests cover a fresh and a stale cache.How to manually test your changes?
Run
shopify version --verbosetwice in a row. Before: both runs start the background notifications process. After: the second run does not, until an hour has passed since the last fetch.Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add