Skip to content

fix(web-ui): Add version check cache to reduce GitHub API calls#4932

Open
roj234 wants to merge 6 commits intoLizardByte:masterfrom
roj234:ui-fix
Open

fix(web-ui): Add version check cache to reduce GitHub API calls#4932
roj234 wants to merge 6 commits intoLizardByte:masterfrom
roj234:ui-fix

Conversation

@roj234
Copy link
Copy Markdown

@roj234 roj234 commented Mar 31, 2026

Description

Each time I refresh Sunshine page, It will request Github API twice, and Github API (no api key) have a one-hour limit, which shared with many other projects.
This PR have added an 1 day cache, so that Sunshine UI only request Github API once per day.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@roj234 roj234 changed the title [UI] Add 1 day version cache avoid exhaust Github API rate limit fix: [UI] Add 1 day version cache avoid exhaust Github API rate limit Mar 31, 2026
@ReenigneArcher
Copy link
Copy Markdown
Member

I'm not sure about caching for a whole day. The limit is 60 requests per hour for unauthenticated requests. I think a 1 hour cache would be okay though so we don't consume more than 2 per hour.

@roj234 roj234 changed the title fix: [UI] Add 1 day version cache avoid exhaust Github API rate limit fix: [UI] Add version check cache avoid exhaust Github API rate limit Apr 2, 2026
@roj234
Copy link
Copy Markdown
Author

roj234 commented Apr 4, 2026

I'm not sure about caching for a whole day. The limit is 60 requests per hour for unauthenticated requests. I think a 1 hour cache would be okay though so we don't consume more than 2 per hour.

OK

@ReenigneArcher
Copy link
Copy Markdown
Member

@roj234 could you please fix the sonar issue? Probably just need to create a helper function to extract some of the logic.

@ReenigneArcher ReenigneArcher changed the title fix: [UI] Add version check cache avoid exhaust Github API rate limit fix(web-ui): Add version check cache to reduce Github API calls Apr 21, 2026
@ReenigneArcher ReenigneArcher changed the title fix(web-ui): Add version check cache to reduce Github API calls fix(web-ui): Add version check cache to reduce GitHub API calls Apr 21, 2026
roj234 added 4 commits April 21, 2026 13:12
Add caching for version data to reduce API calls.
Refactor version fetching logic into a separate function.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.14%. Comparing base (f4ebfbb) to head (27411f8).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4932      +/-   ##
==========================================
- Coverage   18.17%   18.14%   -0.03%     
==========================================
  Files         109      109              
  Lines       23545    23545              
  Branches    10391    10391              
==========================================
- Hits         4280     4273       -7     
+ Misses      16010    14865    -1145     
- Partials     3255     4407    +1152     
Flag Coverage Δ
Archlinux 11.57% <ø> (ø)
FreeBSD-14.3-aarch64 ?
FreeBSD-14.3-amd64 13.74% <ø> (ø)
Homebrew-ubuntu-22.04 13.94% <ø> (ø)
Linux-AppImage 12.52% <ø> (ø)
Windows-AMD64 14.89% <ø> (ø)
Windows-ARM64 13.20% <ø> (+<0.01%) ⬆️
macOS-arm64 19.01% <ø> (ø)
macOS-x86_64 18.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 51 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4ebfbb...27411f8. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Bundle Report

Changes will increase total bundle size by 546 bytes (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sunshine-esm 787.62kB 546 bytes (0.07%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sunshine-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-*.js 546 bytes 47.35kB 1.17%

Files in assets/index-*.js:

  • ./src_assets/common/assets/web/index.html → Total Size: 0 bytes

@ReenigneArcher
Copy link
Copy Markdown
Member

Could you fix the lint errors and rebase? Then I will test this and if all is good, I'll merge it.

@sonarqubecloud
Copy link
Copy Markdown

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