Repository navigation
fix: refetch stale credits balance after two minutes - #231
Merged
Merged
Conversation
The balance cache never expired, so a long-lived Portal process kept showing the first balance it fetched. Non-forced loads now refetch once the cached state is older than MAX_AGE_MS, keeping the old value visible while the refresh runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🧪 Test Build ReadyAPK for PR #231 is available for testing. Download APK from workflow run Artifacts expire after 30 days. |
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.
Summary
PortalBalanceRepositoryreused a loaded balance for the whole process lifetime; only the refresh button or sign-in/out forced a refetch. With the accessibility service keeping the process alive, the credits card could show a weeks-old balance (a customer saw 690 credits remaining while task runs returned 402).MAX_AGE_MS(2 min). The old value stays visible with the existing "Refreshing" text while the request runs; concurrent callers still join one in-flight request.resetForTest().Tests
./gradlew testDebugUnitTest(JDK 17): all pass.🤖 Generated with Claude Code