Skip to content

feat: support for watt process runner#917

Open
fenos wants to merge 2 commits intomasterfrom
process/add-watt-process-runner-support
Open

feat: support for watt process runner#917
fenos wants to merge 2 commits intomasterfrom
process/add-watt-process-runner-support

Conversation

@fenos
Copy link
Contributor

@fenos fenos commented Mar 18, 2026

What kind of change does this PR introduce?

Feature

What is the new behavior?

  • Add Watt support for starting the server in a monitored and multi-CPU system
  • Corrected shutdown order and prevented error messages on shutdown

Additional context

Add any other context or screenshots.

@fenos fenos requested a review from a team as a code owner March 18, 2026 11:13
Copilot AI review requested due to automatic review settings March 18, 2026 11:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for running the service under the Watt/Platformatic process runner (multi-worker), while refining shutdown sequencing to reduce noisy errors and improve cleanup behavior.

Changes:

  • Added watt.json runtime configuration and Platformatic/Watt dependencies.
  • Updated shutdown handling (SIGTERM/SIGINT) and improved cleanup ordering across queue/pubsub/TUS close paths.
  • Adjusted cluster rebalance logic to account for multi-worker setups via a new numWorkers config.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
watt.json Adds Watt/Platformatic runtime configuration for multi-worker process management.
src/start/shutdown.ts Introduces shared graceful shutdown handler and forces exit after shutdown completes.
src/start/server.ts Uses numWorkers to adjust cluster sizing passed to pool rebalancing.
src/internal/queue/queue.ts Simplifies queue shutdown by removing reliance on stopped event sequencing.
src/internal/pubsub/postgres.ts Prevents unlisten calls after pubsub is closed to avoid shutdown errors.
src/http/routes/tus/index.ts Awaits lock notifier shutdown during Fastify onClose.
src/config.ts Adds numWorkers parsed from WORKERS_NUM.
package.json Adds Platformatic/Watt deps and updates Node engine constraint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fenos fenos force-pushed the process/add-watt-process-runner-support branch 4 times, most recently from 8ed98b4 to 5d948df Compare March 18, 2026 13:11
@fenos fenos force-pushed the process/add-watt-process-runner-support branch from 5d948df to 6b83642 Compare March 18, 2026 14:05
)
TenantConnection.poolManager.rebalanceAll({
clusterSize: data.size,
clusterSize: Math.max(Math.floor(data.size / effectiveNumWorkers), 1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of divide, shouldn't we increase (multiply)? tasks vs tasks * workers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and related, what happens if there is no change event is triggered?

@fenos fenos force-pushed the process/add-watt-process-runner-support branch from 8d56571 to 049120e Compare March 18, 2026 15:30
@fenos fenos force-pushed the process/add-watt-process-runner-support branch from 049120e to b76756c Compare March 18, 2026 15:30
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.

3 participants