Skip to content

Desktop: keep the download time left steady (ATO-1342) - #1146

Draft
sosidudku1 wants to merge 2 commits into
rel/xp-buildfrom
bugs-1342-steady-eta
Draft

sosidudku1 wants to merge 2 commits into
rel/xp-buildfrom
bugs-1342-steady-eta

Conversation

@sosidudku1

@sosidudku1 sosidudku1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes ATO-1342.

What was wrong. On a 1.3 GB download that took about 3 minutes, the time left on the download card jumped: 5 min, 9 min, 2 min, under a minute, 4 min, 8 min. A foreground models pull writes a line for every progress tick while the percent is a multiple of 5, with bytes rounded to 0.01 GB. dlRateStep took a slope between any two lines, so lines from one burst gave a speed of zero or far above the real one.

What changed

  • dlRateStep keeps the previous sample until the bytes have moved and at least 3 seconds have passed, so a slope spans the whole stretch (then the same 0.3 smoothing as before).
  • The estimate starts over when the byte counter goes back (a restarted download). A stall of 300 s drops the rate but keeps the moment the counter first showed those bytes, so slow links (100 KB/s, a step every ~100 s) neither blank the estimate nor read twice the real speed.
  • A slope spans at least four 0.01 GB steps, so a burst's first line, rounded half a step up, cannot read as many times the real speed.
  • The cost: the first estimate shows a few seconds later.
  • New test desktop/test/download-eta-steady.test.mjs replays the CLI's bursty lines and checks the estimate stays within range of the truth, at 28 MB/s and at 100 KB/s.

How to check. Download a model of a few GB from Settings or the picker and watch the card: the time left moves down steadily instead of jumping between 2 and 9 minutes.

Not yet checked on the second Mac.

A foreground `models pull` writes a line for every progress tick while the
percent is a multiple of 5, with bytes rounded to 0.01 GB. dlRateStep took a
slope between any two lines, so lines from one burst gave a speed of zero or
far above the real one and the time left on the download card jumped.

Keep the previous sample until the bytes have moved and at least 3 seconds
have passed, so a slope spans the whole stretch. Measure afresh when the byte
counter goes back or stays still for 60 seconds. The first estimate appears a
few seconds later.
The CLI prints bytes in 0.01 GB steps, so at 100 KB/s the counter sits
still for over a minute between steps. The 60 s stall reset blanked the
estimate at every step and moved the last sample to the reset, so the
next slope read twice the real speed and the time left showed about half.

A stall now needs 300 s, keeps the moment the counter first showed those
bytes, and only drops the rate. A slope also has to span at least four
0.01 GB steps, so a burst's first line, rounded half a step up, cannot
read as many times the real speed. A 100 KB/s replay joins the tests.

This branch has not been deployed

No deployments
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.

1 participant