Skip to content
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

ref(update): Adding caching to checking for latest version #179

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

IanWoodard
Copy link
Member

Currently we hit the GitHub api each time a command is run which can lead to being rate limited and adds additional bloat that makes commands feel less snappy. To remedy this, this change adds a simple caching mechanism that stores the version it retrieves from the GitHub api for 15 minutes before refetching again. This should be often enough to still promptly inform users of updates while not sending unnecessary requests to the GitHub api.
I also moved check_for_update out of commands and into utils where I believe it belongs. I also added some preliminary testing for check_for_update.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.75%. Comparing base (0f26f0b) to head (fd3eebc).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #179      +/-   ##
==========================================
+ Coverage   92.03%   92.75%   +0.71%     
==========================================
  Files          22       22              
  Lines        1306     1339      +33     
==========================================
+ Hits         1202     1242      +40     
+ Misses        104       97       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@hubertdeng123 hubertdeng123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! 🚀

devservices/utils/check_for_update.py Show resolved Hide resolved
@IanWoodard IanWoodard merged commit 2af25a6 into main Dec 13, 2024
14 checks passed
@IanWoodard IanWoodard deleted the iw/latest-version-cache branch December 13, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants