Fix "Zeno’s paradox" like logic of the progress calculation.#26235
Conversation
a4a4b81 to
adf7a98
Compare
adf7a98 to
6998f5f
Compare
|
Previously, the result set was limited to a single 'news' request. This fix allows it to return all records, but on my laptop (Chrome), the UI becomes unusable once the table exceeds 10,000 rows. It seems reasonable to cap the result set at 10,000 records until the current UI implementation can handle larger datasets. What do you think? |
You got a screenshot or video to demonstrate what you mean? |
jglick
left a comment
There was a problem hiding this comment.
This should work better indeed, based on a numeric evaluation up to 10_000 iterations: gets up to ~99.90009% rather than quickly hitting the double overflow after 99.99999999999999%.
| * The first increment will be sized as if this many runs will be in the total, | ||
| * but then like Zeno’s paradox we will never seem to finish until we actually do. |
There was a problem hiding this comment.
From #1046 apparently. I have little recollection of this.
Well the server would be churning through thousands of little XML files on disk by that point. Ideally all UI elements related to lazy loading would be redesigned to use the “infinite scrollbar” trick so the server does not load records unless and until the user expresses an interest in viewing them. |
Agree. The question is: do we need a limit for the existing UI? Before this fix, the dataset was limited by an incorrect progress calculation. I received between 1k and 10k records on the build history page, depending on network latency, server load, and other random factors. |
will do tomorrow |
|
Feel free to impose some sort of deliberate cap on the number of results returned. |
| * but then like Zeno’s paradox we will never seem to finish until we actually do. | ||
| */ | ||
| private static final double MAX_LIKELY_RUNS = 20; | ||
| private static final int LIMIT = SystemProperties.getInteger(RunListProgressiveRendering.class.getName() + ".limit", Integer.MAX_VALUE); |
There was a problem hiding this comment.
should we put some sort of sensible limit here instead of max value? As Jesse said ideally the frontend would only request more builds if the user is actually scrolling.
There was a problem hiding this comment.
I'm planning to set a 10,000 request limit on my Jenkins installation, but I'm not confident enough to say that this will be a reasonable default limit. So I leave this choice to you.
There was a problem hiding this comment.
500 or 1000 is probably fine, I would expect the browser to probably start struggling after that.
| Iterator<? extends Run<?, ?>> iter = builds.iterator(); | ||
| while (iter.hasNext() && !canceled() && processed < LIMIT) { | ||
| Run<?, ?> build = iter.next(); |
There was a problem hiding this comment.
A bit more legible IMO as the for loop it was before.
MarkEWaite
left a comment
There was a problem hiding this comment.
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.
/label ready-for-merge
The previous progress calculation logic is not infinite.
The following test demonstrates that after 730 iterations, the progress reaches 100%:
Output:
Iterations: 730As a result, the UI receives status: done and stops fetching additional results, while the backend continues iterating through all remaining builds (during 15 second timeout)
Testing done
Manual testing on local env done
Before
After
Proposed changelog entries
Proposed changelog category
/label bug
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@jglick
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.