Skip to content

fix(mega): stop parallel upload workers creating duplicate series folders - #241

Merged
Gnathonic merged 1 commit into
developfrom
fix/mega-folder-dupes
Jun 30, 2026
Merged

fix(mega): stop parallel upload workers creating duplicate series folders#241
Gnathonic merged 1 commit into
developfrom
fix/mega-folder-dupes

Conversation

@Gnathonic

Copy link
Copy Markdown
Owner

Each MEGA upload worker has its own Storage (own file tree) and created the series folder itself with mkdir, so concurrent uploads to one series each made a duplicate. The main thread's prepareUploadTarget() already creates the folder once (mutex-coalesced) but returned void.

Now prepareUploadTarget() returns the series-folder node id (already merged into worker credentials by backup-queue); the worker resolves that folder by id — reloading once if its cached tree predates it — and never mkdirs 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

…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>
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mokuro-reader Ready Ready Preview, Comment Jun 30, 2026 8:27am

Request Review

@Gnathonic
Gnathonic merged commit c67ce31 into develop Jun 30, 2026
9 checks passed
@Gnathonic
Gnathonic deleted the fix/mega-folder-dupes branch June 30, 2026 08:28
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
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