fix(graphql): route makePgService pools through pg-cache in explorer and server - #861
Merged
pyramation merged 1 commit intoMar 20, 2026
Merged
Conversation
…and server Same pattern as the buildSchemaSDL fix (PR #860): makePgService({ connectionString }) creates internal pools invisible to pg-cache. Route through getPgPool() instead so pools are tracked and properly cleaned up during database teardown.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
pyramation
deleted the
devin/1774038000-fix-untracked-makepgservice-pools
branch
March 20, 2026 23:08
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.
Summary
Follow-up to #860. Applies the same fix to two more call sites where
makePgService({ connectionString })created PostGraphile-internal pools invisible topg-cache:graphql/explorer/src/server.ts— the GraphQL Explorer's dynamic schema introspectiongraphql/server/src/middleware/graphile.ts— the main GraphQL server middleware (buildPreset)Both now use
getPgPool(pgConfig)to obtain a pg-cache-tracked pool and pass it viamakePgService({ pool }).A third instance in
graphql/query/src/executor.tswas identified but intentionally left out: it has no external consumers, doesn't depend onpg-cache, and uses a different lifecycle (postgraphile()+pgl.release()).Review & Testing Checklist for Human
makePgService({ pool })behaves identically tomakePgService({ connectionString })— PostGraphile's@dataplan/pgadaptor accepts both, but confirm there are no subtle differences in pool configuration, connection limits, or adaptor behavior (e.g., does PostGraphile callpool.end()on release when it doesn't own the pool?).getPgPoolcaches by database name. Multiple PostGraphile instances hitting the same database (e.g., different schemas in the explorer, or multiple tenants in the server) will now share a single pool. Previously eachmakePgService({ connectionString })call created an independent pool. Verify this doesn't cause connection starvation under concurrent load.Notes
buildPresetsignature ingraphile.tschanged its first parameter fromconnectionString: stringtopool: import('pg').Pool. This is internal-only (not exported).buildConnectionStringimport is removed from both files since it's no longer needed.Link to Devin session: https://app.devin.ai/sessions/a8cbad4ea6f2434b87fc29ac082105fd
Requested by: @pyramation