mirror of
https://github.com/NodeDaemon/NodeDaemon.git
synced 2026-04-27 08:15:55 +03:00
[PR #2] [MERGED] fix: prevent duplicate instance creation in gracefulReload #1
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/NodeDaemon#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/NodeDaemon/NodeDaemon/pull/2
Author: @ersinkoc
Created: 11/5/2025
Status: ✅ Merged
Merged: 11/5/2025
Merged by: @ersinkoc
Base:
main← Head:claude/identify-and-fix-bug-011CUoybhg5RCPhRPNAPvgXy📝 Commits (1)
f3a7021fix: prevent duplicate instance creation in gracefulReload📊 Changes
2 files changed (+294 additions, -8 deletions)
View changed files
📝
src/core/ProcessOrchestrator.ts(+9 -8)➕
tests/unit/graceful-reload-bug.test.js(+285 -0)📄 Description
Fixes a critical bug in ProcessOrchestrator.gracefulReload where each worker reload would create duplicate instance objects.
Bug Description:
The
gracefulReloadmethod was creating instance objects and pushing them to the instances array (line 606), then callingstartClusterInstance(line 609) which creates ANOTHER instance object with a different ID and pushes that too. This resulted in 2 instance objects per worker.Root Cause:
Impact:
Fix:
Modified gracefulReload to use
spawnClusterWorkerForInstance()instead ofstartClusterInstance(). This reuses the instance object created in gracefulReload rather than creating a new one.Before Fix:
After Fix:
Testing:
Added comprehensive test suite in graceful-reload-bug.test.js that verifies:
All 5 new tests pass. Existing test suite shows no regressions (55/58 passing).
Location: src/core/ProcessOrchestrator.ts:586-622
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.