Repository navigation
Web viewer: a page that was loading when the tab was hidden or auto-refresh paused now refreshes normally on return (#4774) - #4781
Merged
Conversation
…to-refresh is paused settles at its own end (#4774) The settle check sat below the hidden-or-paused return in the scheduler tick, so a render whose reads finished during such a span stayed open until the first visible, unpaused tick. Its duration then counted the whole span, the back-off pushed the next refresh out to 15 minutes with "(slow page)", and the page was never due. The check now runs first on every tick, so the render ends when its reads do and the next refresh is scheduled from that moment. The new tests run the real app.js scheduler and refresh-policy.js under Node on a virtual clock.
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.
Fixes #4774.
Why
In the Darling web viewer, a page render sets
pageRenderingand stamps its start. The only call that settles it, inschedulerTick, sat below the hidden-or-paused return. So a render whose reads finished while the tab was hidden, or while auto-refresh was paused, stayed open:pageIsDueneeds!pageRendering, and returning to the tab only refreshes the shell.I reproduced it on the unmodified scheduler by running the real
app.jsandrefresh-policy.json a virtual clock. A render whose reads took 2 seconds, with the tab hidden for 10 minutes, measured 601,000 ms, put the next refresh 15 minutes out, showed "(slow page)" and never started a new render. A tab opened in the background, and a pause flag cleared from another tab, gave the same result.What changes
Darling/PerformanceMonitor.Darling.Service/wwwroot/js/app.js:schedulerTicknow reads the clock and runs the existing settle check (if (pageRendering && !hasInFlightReads()) settlePageRender(now);) first, then the hidden-or-paused return. The return's line is unchanged (WebFetchLayerTestspins its text). A render now ends at the first tick that sees no reads in flight, whether or not the tab is hidden or auto-refresh is paused, and the next refresh is scheduled from that moment. The back-off policy is unchanged.refresh()androute()return early in that state.Darling/Darling.Tests/web-scheduler-harness.mjsruns the shippedapp.jsscheduler on a virtual clock. It removes app.js's import lines and its closingstart()call, replaces the imports with stand-ins (page renders open a read that stays out for a set time, andhasInFlightReads()counts them), and uses the realrefresh-policy.js. If app.js's layout changes so it cannot separate those lines, it throws instead of passing.Darling/Darling.Tests/WebRenderSettleTests.csruns seven checks. Six run scenarios under Node and skip silently when Node is not installed, the wayWebAutoRefreshPolicyTestsdoes. The seventh reads the source and pins that the settle call comes before the hidden-or-paused return, so a machine without Node still holds the fix.Test plan
Scenario numbers, from the harness (the render's reads take 2 s; the interval is 60 s):
WebRenderSettleTestsagainst the unmodifiedapp.js: 6 of 7 fail, and the still-loading check passes (it pins behavior that must not change). After the fix all 7 pass.WebRenderSettleTests,WebFetchLayerTests,WebAutoRefreshPolicyTests,RepoFileAdoptionTests,RepoFileResolutionEquivalenceTests,DocCommentHygieneTests): Total 127, Failed 0.Darling.Tests: 0 warnings, 0 errors.Darling.Testssuite once, after merging origin/dev, with no PostgreSQL rig: Total 17205, Failed 0, Skipped 1123 (live tests that need a rig), Not Run 1.Note on the pause case: the "Paused with the button" scenario already ended normally before the fix, because resuming forces a page refresh that restamps the render start. What the fix changes there is that the render is settled during the pause instead of staying open. The case that failed end to end for a pause is the flag being cleared by another tab (the flag lives in localStorage), which has no click to force a refresh.
CHANGELOG
SECTION: Fixed
ENTRY:
REF:
[A page render interrupted by a hidden tab or a pause never settles, and the page backs off to 15 minutes #4774]: A page render interrupted by a hidden tab or a pause never settles, and the page backs off to 15 minutes #4774