Skip to content

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

Closed
roj234 wants to merge 5 commits into
LizardByte:masterfrom
roj234:ui-fix
Closed

fix(web-ui): Add version check cache to reduce GitHub API calls#4932
roj234 wants to merge 5 commits into
LizardByte: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

@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
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
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@33bdb01). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4932   +/-   ##
=========================================
  Coverage          ?   17.84%           
=========================================
  Files             ?      111           
  Lines             ?    24029           
  Branches          ?    10619           
=========================================
  Hits              ?     4288           
  Misses            ?    18182           
  Partials          ?     1559           
Flag Coverage Δ
Archlinux 11.23% <ø> (?)
FreeBSD-14.3-amd64 13.37% <ø> (?)
Homebrew-ubuntu-22.04 13.58% <ø> (?)
Linux-AppImage 12.16% <ø> (?)
Windows-AMD64 14.84% <ø> (?)
Windows-ARM64 13.22% <ø> (?)
macOS-arm64 18.99% <ø> (?)
macOS-x86_64 18.36% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 33bdb01...ad08a5f. 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 788.48kB 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.31kB 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

@sonarqubecloud
Copy link
Copy Markdown

@ReenigneArcher
Copy link
Copy Markdown
Member

Just got around to testing this. Unfortunately it doesn't show notifications for the pre-release versions if the user has that option enabled.

@roj234
Copy link
Copy Markdown
Author

roj234 commented May 15, 2026

我气死了一个十行的pr拖了一个多月了你自己去写不行吗又在那里要过代码质量又要过测试一个月才一个回复一个人高傲的像大公司你以为我非要这个contributor吗爱修不修我直接close反正我本地还能patch

@ReenigneArcher
Copy link
Copy Markdown
Member

🫡

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