fix(upload): harden upload progress and terminal-state handling#2117
Open
joshtrichards wants to merge 2 commits into
Open
fix(upload): harden upload progress and terminal-state handling#2117joshtrichards wants to merge 2 commits into
joshtrichards wants to merge 2 commits into
Conversation
- ignore stale progress updates after assembling or terminal states - clamp tracked uploaded bytes to the valid range - tighten Status typing on the status getter - improve Upload model documentation and inline comments Signed-off-by: Josh <josh.t.richards@gmail.com>
- ignore stale progress updates after uploads reach terminal states - avoid unnecessary progress mutations and stats recalculations from late async callbacks - preserve existing retry and queue orchestration behavior Signed-off-by: Josh <josh.t.richards@gmail.com>
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.
This PR hardens upload progress tracking across
UploadandUploaderby ignoring stale byte-progress updates once uploads enter assembling or terminal states.Upload.uploadedsetter against updates once the upload entersASSEMBLING,CANCELLED,FAILED, orFINISHED(this is the authoritative state gate)Uploadercallback sites (onUploadProgress,onUploadRetry, and chunk.then()) when the upload is already in a non-updatable state (to avoid unnecessaryupdateStats()calls; primary protection is already provided by the new guard inUpload.uploaded)0..sizerange to keep progress reconciliation safe during retries and async updatesgetMaxChunksSize()call in theUploadconstructor (was called three times; now called once and a tad more natural to read)this.eta.reset()->this._eta.reset()inupdateStats()Upload.statusgetter return type fromnumbertoStatusUploadThis primarily hardens upload state transitions against late async progress callbacks, which can otherwise cause transient progress or ETA inconsistencies around retries, cancellation, and chunk assembly.
🤖 AI (if applicable)