fix(mega): stop parallel upload workers creating duplicate series folders - #241
Merged
Conversation
…ders Each upload worker has its own Storage (own file tree), and the worker created the series folder itself via mkdir. Concurrent uploads to one series therefore each found no folder and mkdir'd a duplicate. The main thread's prepareUploadTarget() already creates the folder once (mutex- coalesced) but returned void, so the work was discarded. prepareUploadTarget() now returns the series folder node id, which is merged into the worker credentials. The worker resolves that folder by id (reloading once if its cached tree predates the folder) and never mkdir's on the normal path — so parallel workers can't create duplicates. A name-based fallback remains only for the (now unused) no-id case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
adrian-tompkins
pushed a commit
to adrian-tompkins/mokuro-reader
that referenced
this pull request
Aug 2, 2026
…ue-race-condition fix: Prevent duplicate downloads in queue due to race condition
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.
Each MEGA upload worker has its own
Storage(own file tree) and created the series folder itself withmkdir, so concurrent uploads to one series each made a duplicate. The main thread'sprepareUploadTarget()already creates the folder once (mutex-coalesced) but returnedvoid.Now
prepareUploadTarget()returns the series-folder node id (already merged into worker credentials bybackup-queue); the worker resolves that folder by id — reloading once if its cached tree predates it — and nevermkdirs on the normal path. Also fixes nested series paths. Unit tests cover the resolver + the new return value; 754 tests pass; live-verified (concurrent same-series upload → one folder).🤖 Generated with Claude Code