Skip to content

reduce rerenders from run times#842

Merged
timja merged 6 commits intojenkinsci:mainfrom
lewisbirks:live-timings
Jun 17, 2025
Merged

reduce rerenders from run times#842
timja merged 6 commits intojenkinsci:mainfrom
lewisbirks:live-timings

Conversation

@lewisbirks
Copy link
Contributor

@lewisbirks lewisbirks commented Jun 11, 2025

Each poll currently will cause a re-render even if the stage is still in progress due to the total time changing.

const hasNewSteps =
JSON.stringify(stepsRef.current) !== JSON.stringify(data);

My proposal to address this is to instead return a total time of null untill the run is no longer in progress. In the frontend we can the just kick off a timer which will update every x to ensure that the total increases (essentially faking the data). Once null is no longer sent across then it can be replaced with the actual time.

TODO:

  • Update all required places where totalDurationMillis is used

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Comment on lines -405 to -408
if (!text) {
// shouldn't happen
continue;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timja what was the reason for this having to be accounted for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm I think was just a safety thing, if it says shouldn't happen then likely wasn't expected in practice

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks marked this pull request as ready for review June 17, 2025 14:55
@lewisbirks lewisbirks requested a review from a team as a code owner June 17, 2025 14:55
if (total == null) {
const interval = setInterval(() => {
setDuration(sinceStart());
}, 3001); // to match step polling interval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I increased this in b25d987

As I was noticing while watching live that numbers were going higher than the final result.

Added + 1 so that this starts just after it and is less likely to go over the final result

@timja timja enabled auto-merge (squash) June 17, 2025 15:17
@timja timja merged commit 8a7f439 into jenkinsci:main Jun 17, 2025
16 of 17 checks passed
@lewisbirks lewisbirks deleted the live-timings branch June 18, 2025 08:23
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