fix(worker): remove unused jsonPaths assignment from createMetacallJsonFiles - #160
Draft
prathamesh04 wants to merge 3 commits into
Draft
fix(worker): remove unused jsonPaths assignment from createMetacallJsonFiles#160prathamesh04 wants to merge 3 commits into
prathamesh04 wants to merge 3 commits into
Conversation
Fixes infinite loop in assignColorToWorker when all 16 ANSI colors are allocated. Previously, the do...while loop would spin forever looking for an unassigned color, blocking the Node.js event loop and hanging the server at 17+ concurrent deployments. Changes: - Replace random retry with deterministic round-robin index - Remove assignedColorCodes tracking map (no longer needed) - Remove unused AssignedColorCodesType interface - Remove stale TODO comments Colors cycle safely when more than 16 deployments are active. Fixes metacall#116
The deleteFolder helper in packageUpload was using fs.unlink to remove
the application directory on upload failure. fs.unlink is the POSIX
unlink syscall which only removes a single file inode, not a directory.
When called on a directory path, it fails with EISDIR (Linux/macOS) or
EPERM (Windows), leaving the orphaned directory on disk. Subsequent
upload attempts for the same resource.id may then fail because
ensureFolderExists finds the folder already exists.
Changes:
- Replace fs.unlink with fs.rm({ recursive: true, force: true })
- This correctly removes the entire directory tree
Fixes metacall#119
…onFiles The handleDeployment function was capturing the return value of createMetacallJsonFiles into a jsonPaths variable. However, createMetacallJsonFiles returns Promise<void>, so jsonPaths was always undefined. This misleading assignment could cause a future developer to accidentally use the wrong jsonPaths variable (shadowed at line 103), leading to silent bugs. Changes: - Await createMetacallJsonFiles without capturing return value - Remove unused variable assignment Fixes metacall#133
Contributor
Author
Contributor
Author
Video DemonstrationI've recorded a video demonstrating PR #160: What the video shows:
Key change: // Before (unused variable - always undefined)
const jsonPaths = await createMetacallJsonFiles(resource.path, resource.jsons);
// After (removed unused assignment)
await createMetacallJsonFiles(resource.path, resource.jsons);Why this fix matters:
Video file attached below: |
Contributor
Author
Video Attached ✅I've recorded and attached a video demonstrating PR #160. Video includes:
Summary of the fix:
|
Member
|
Again you have pushed multiple things in the same PR, I cannot merge this... @prathamesh04 |
viferga
marked this pull request as draft
August 3, 2026 15:01
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.
Description
The
handleDeploymentfunction was capturing the return value ofcreateMetacallJsonFilesinto ajsonPathsvariable. However,createMetacallJsonFilesreturnsPromise<void>, sojsonPathswas alwaysundefined.This misleading assignment could cause a future developer to accidentally use the wrong
jsonPathsvariable (shadowed at line 103), leading to silent bugs.Fixes #133
Changes
createMetacallJsonFileswithout capturing return valueChecklist
npm run build)npm run lint)