Open
Conversation
There was a problem hiding this comment.
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.jsonruntime 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
numWorkersconfig.
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.
8ed98b4 to
5d948df
Compare
ferhatelmas
reviewed
Mar 18, 2026
5d948df to
6b83642
Compare
ferhatelmas
reviewed
Mar 18, 2026
src/start/server.ts
Outdated
| ) | ||
| TenantConnection.poolManager.rebalanceAll({ | ||
| clusterSize: data.size, | ||
| clusterSize: Math.max(Math.floor(data.size / effectiveNumWorkers), 1), |
Member
There was a problem hiding this comment.
instead of divide, shouldn't we increase (multiply)? tasks vs tasks * workers
Member
There was a problem hiding this comment.
and related, what happens if there is no change event is triggered?
8d56571 to
049120e
Compare
049120e to
b76756c
Compare
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.
What kind of change does this PR introduce?
Feature
What is the new behavior?
Additional context
Add any other context or screenshots.