Skip to content

feat: add dynamic configuration hot-reloading using FS watcher#213

Open
realkalashnikov wants to merge 1 commit into
PerformanC:devfrom
realkalashnikov:feat/config-hot-reload
Open

feat: add dynamic configuration hot-reloading using FS watcher#213
realkalashnikov wants to merge 1 commit into
PerformanC:devfrom
realkalashnikov:feat/config-hot-reload

Conversation

@realkalashnikov

Copy link
Copy Markdown

Description

This PR implements a dynamic configuration hot-reloading mechanism for NodeLink. It allows users to modify config.ts or config.js in the root directory and apply changes in real-time across the Master server and all cluster Worker processes without requiring a physical restart, preserving active audio streams and 99.9% uptime.

Key Changes

  • Dynamic Loading & Cache Busting: Modified the loadConfig function to optionally support a timestamp query parameter for ESM dynamic imports, bypassing Node.js module loader caching.
  • FS Watcher: Added a debounced (200ms) directory-level fs.watch looking for config.ts/config.js updates during Master/Single process bootstrap.
  • Master Re-initialization: When configuration changes:
    • Re-applies environment overrides.
    • Re-initializes logger options.
    • Dynamically triggers folder reloads on active managers (sources, lyrics, meanings).
  • IPC Propagation: Added an updateConfig method to WorkerManager that updates its local scaling properties/timeouts and broadcasts { type: 'updateConfig', payload: newConfig } IPC messages to all active child cluster workers.
  • Worker Refresh: Cluster workers listen to the IPC update event, refresh local config states, and reload their respective active audio source/lyrics/meanings directories in-place.

Testing

  • Verified TypeScript compiler checks locally via npm run type-check (compiles successfully without type errors).
  • Verified that ESM modules reload properly with dynamic parameters.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

All Contributors have signed the CLA. The PR is now allowed to be merged.
Posted by the CLA Assistant Lite bot.

@realkalashnikov realkalashnikov force-pushed the feat/config-hot-reload branch from 46ff84f to b3e2514 Compare June 23, 2026 20:49
@realkalashnikov

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

performanc-bot added a commit to PerformanC/CLA-Signatures that referenced this pull request Jun 23, 2026
@realkalashnikov realkalashnikov changed the base branch from v3 to dev June 23, 2026 20:57
@realkalashnikov

Copy link
Copy Markdown
Author

I forgot to switch branches 🤓

@PerformanC PerformanC locked and limited conversation to collaborators Jun 23, 2026
@PerformanC PerformanC unlocked this conversation Jun 23, 2026
@UnschooledGamer

This comment was marked as outdated.

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.

2 participants