-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(cache): invalidate SCM caches when branch changes #6014
Conversation
This is only a WIP, but wanted to get any initial feedback. I realized as I was about to submit this that I don't think we can take a cache "tag" (with HTTP etags as an influence) only into account but will have to consider that along with a cache duration because info like the number of modified, removed, and added files, etc., is also part of that cache and would never update. Still, it's a start, if you're interested in the feature and have any initial feedback. |
I updated the algorithm to always take duration into account. Testing with local edits, this works and makes much more sense. I set my duration to 10s and added/removed files. The prompt most often doesn't pick them up right away unless I switch branches or checkout HEAD~ as detached, etc. If you're good with this, I can proceed with any feedback, add tests, and update other SCMs that could benefit. I'd have to research a few of them given either lack of familiarity or, like with mercurial, it's been a while since I've used and don't remember its housekeeping. |
Tested against main and linked worktrees as well as submodules. Switching branches immediately refreshes info e.g., repo modifications. cd'ing into submodules and back retains the cache for the specified duration e.g., 30s. |
011cba3
to
962e2ea
Compare
@all-contributors please add @heaths for code This is pure magic 🪄! @holopin-bot @heaths wizard |
Congratulations @heaths, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/cm4tlltuc34590cjg2k9z90st This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
I've put up a pull request to add @heaths! 🎉 |
Resolves #6012