feat: Add an option to use workers for typescript formatting - #1102
Merged
avallete merged 2 commits intoAug 11, 2026
Merged
Conversation
dcamachoc
force-pushed
the
davidcamachocateura/api-1585-add-option-to-use-workers-to-format-types
branch
from
August 11, 2026 16:14
9d7af95 to
6ad077a
Compare
dcamachoc
force-pushed
the
davidcamachocateura/api-1585-add-option-to-use-workers-to-format-types
branch
from
August 11, 2026 16:15
6ad077a to
5e64c16
Compare
avallete
approved these changes
Aug 11, 2026
avallete
deleted the
davidcamachocateura/api-1585-add-option-to-use-workers-to-format-types
branch
August 11, 2026 16:56
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?
Main thread relief (opt-in through
PG_META_FORMAT_IN_WORKER)What is the current behavior?
Formatting is always executed within the main thread. While generating types for a table with significant tables or relationships, it can block the event loop for several seconds, leaving other requests and health checks unattended.
What is the new behavior?
When the environment variable
PG_META_FORMAT_IN_WORKERis set totrue, the typescript generator will use a worker to format the generated types, unblocking the main event loop.It can be configured using
PG_META_FORMAT_POOL_SIZE,PG_META_FORMAT_MAX_QUEUE,PG_META_FORMAT_TIMEOUT_MSandPG_META_FORMAT_IDLE_TIMEOUT_MS.