Skip to content

fix: apply each update an upload streams back once, with a synchronous event listener - #7721

Merged
FarhanAliRaza merged 5 commits into
reflex-dev:mainfrom
benedikt-bartscher:fix/upload-chunks-once
Nov 4, 2026
Merged

FarhanAliRaza merged 5 commits into
reflex-dev:mainfrom
benedikt-bartscher:fix/upload-chunks-once

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7720.

uploadFiles counted a streamed chunk as processed in a .then() on what the socket's "event" listener returned. Since #6827 that listener is synchronous and returns undefined, so the .then threw after the update was applied, the chunk was never counted, and every later download progress event applied all updates received so far again.

This PR:

  • counts a chunk as processed once it parses, before it is handled, so no later progress event handles it again, whether the listener is sync or async
  • reports a listener that throws or rejects as "Error processing chunk", once, without retrying the chunk or holding up the next one
  • keeps the existing handling of an incomplete last chunk: it fails to parse, is not counted, and is parsed again with the rest of it on the next progress event

tests/units/reflex_base/client_upload.mjs loads the real upload.js and streams three updates over three progress events, the last one split across two of them. A synchronous listener handled them as 1, 1, 2, 1, 2, 3 before and 1, 2, 3 now; an async listener, like the one before #6827, handles them once with and without the fix; and a listener that throws or rejects its promise is reported once and its update not retried.

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Summary

Prevents upload updates from running again on later download progress events.

  • File uploads apply each complete streamed update only once.

Both earlier, unnumbered findings are addressed: rejected promises now have coverage, and the news entry describes the user-visible fix.

Reviews (4) · Last reviewed commit: "Merge branch 'main' into fix/upload-chun..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 4.16%

1 warning

⚠️ 13 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

❌ 1 regressed benchmark
✅ 147 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_route_argument_extraction 114.8 µs 119.8 µs -4.16%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing benedikt-bartscher:fix/upload-chunks-once (7a07813) with main (4f1d657)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (b04a9ca) during the generation of this report, so 4f1d657 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@masenf masenf added the bug Something isn't working label Nov 2, 2026
benedikt-bartscher and others added 2 commits November 2, 2026 21:34
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review November 2, 2026 20:35
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner November 2, 2026 20:35

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

View guided diff | Re-trigger cubic

@FarhanAliRaza
FarhanAliRaza merged commit efa05c2 into reflex-dev:main Nov 4, 2026
182 of 185 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload responses are re-applied on every download progress event since #6827

3 participants