Repository navigation
feat: show how much sooner combining networks finished a download - #255
Open
Arpit-Khandelwal wants to merge 1 commit into
Open
Arpit-Khandelwal wants to merge 1 commit into
Arpit-Khandelwal wants to merge 1 commit into
Conversation
Each network now keeps how long it was delivering bytes (activeMs), sampled on the download's tick from its meter. It lives on the download's networks, so it is saved with the manifest and kept in history. The Complete screen uses it to say "About 4 min sooner than Wi-Fi alone" when at least two networks carried a real share, the download ran 10 s or more, and the saving is at least 5 s and 5% of the time alone. The estimate compares against the fastest network's speed while it took part (see src/shared/timeSaved.ts). The contribution bar gets a text equivalent for screen readers and fills in once on open. The completion notification says the same when there is a saving. Telegram downloads never show it, since their per-network bytes don't follow the route.
This branch has not been deployed
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.
Closes #240 (part of #239, related to #83).
What it does
When a download finishes over two or more networks, the Complete screen now says how much sooner it came in than the fastest of those networks would have managed alone, e.g. "About 4 min sooner than Wi-Fi alone". It sits under "Contribution by network", just above the bar.
scaleXkeyframe, so the global reduced-motion rule makes it instant.How it works
activeMs, for how long it was actually delivering bytes. On every tick of the run loop, a network whose meter counted new bytes since the last tick gets the tick's time added. It lives onnetworks, so it's saved with the manifest across a relaunch and kept inhistory.jsonwith no extra plumbing. It costs one number per network.src/shared/timeSaved.tsholds the estimate:activeMsand just don't show the line.About the estimate: a network's speed while sharing isn't its speed alone. If both networks go through the same bottleneck (one router behind both, a server capping the whole download, a slow disk), each one ran slower next to the other than it would have alone, and the saving reads bigger than it really was. Plexo can't tell that case apart, which is why the line says "about" and only appears above those thresholds. In other ways the estimate leans conservative:
The full reasoning is in the comment at the top of
timeSaved.ts.Screenshots
These are in
features/shots/. Each one is a finished download loaded from a hand-writtenhistory.json(Wi-Fi + iPhone USB, 1.2 GB in 6:10, 62% / 38%):time-saved-two-light.png,time-saved-two-dark.png: shows "About 4 min sooner than Wi-Fi alone" above the two-color bar.time-saved-one-network-light.png,time-saved-one-network-dark.png: a Wi-Fi-only download. It has no saving line and is otherwise unchanged.I also caught the bar mid-fill with reduced motion off to make sure it animates. That throwaway shot isn't included.
Testing
New
e2e/timeSaved.spec.ts:format.spec.ts:activeMs(an old entry), or with one that isn't a numberaandb): a ~14 s throttled download completes. The Complete screen shows the bar's text ("a 50%, b 50%") and "About N sec sooner than a/b alone". After a relaunch, the entry opened from Finished still shows both. In a debug run it measured 14.16 s active per network over a 14.18 s download, which came to "About 15 sec sooner".Not covered: no e2e test sees the notification text, because notifications are switched off under test (
notify()returns early). The phrase comes from the same testeddescribeTimeSaved, but the notification's custom-name lookup and its sentence wording were only checked by reading the code.Fails without the change:
src/mainandsrc/rendererreverted (the shared module kept so the spec compiles), both Complete-screen tests fail because the bar has no text equivalent.src/mainreverted (noactiveMsrecorded), the two-network test fails on the "sooner than" line.Commands, all passing:
bun run typecheck:node,typecheck:web,typecheck:e2e,lint,format:check,bunx electron-vite buildPLEXO_E2E_SKIP_BUILD=1 bunx playwright test timeSaved format download ui invariants downloadUpdate lifecycle network --workers=2: 91 passed, 1 skipped (an existing skip).PLEXO_E2E_SKIP_BUILD=1 bunx playwright test torrent nzb telegram recovery limits liveNetworks --workers=2: 63 passed.For you to decide
timeSaved.tsif you'd rather be stricter or looser.Part of #239. Ready to look at, but still waiting for @anmolkapil's yes on #240. Happy to change course, or close it if the idea isn't wanted.