WPB-24882 improve connection pool management - #5375
Merged
Merged
Conversation
battermann
marked this pull request as ready for review
July 27, 2026 15:22
Contributor
There was a problem hiding this comment.
Pull request overview
This PR (WPB-26489) updates Arbiter integration to improve PostgreSQL connection pool management by ensuring background-worker job execution uses the shared Hasql pool (and avoids dedicating extra long-lived connections), alongside an Arbiter dependency bump and related API adjustments.
Changes:
- Switch background-worker Arbiter workers to a pool-backed, poll-only execution model (no LISTEN/NOTIFY listener connection; shared Hasql pool for DB work).
- Move/centralize Arbiter migration connection-string construction into
wire-subsystems(mkArbiterConnectionString) and update services to use it. - Update Arbiter-related types/APIs (e.g.,
JobRegistrydefinition) and align Nix/Cabal deps plus operator documentation/changelog.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services/galley/src/Galley/Run.hs | Uses mkArbiterConnectionString for Arbiter migrations; keeps Hasql pool usage unchanged. |
| services/background-worker/src/Wire/BackgroundWorker/Workers.hs | Switches worker pools to transactionalWorkerConfig, removes dedicated Arbiter conn-str usage, and uses pool shutdown helpers. |
| services/background-worker/src/Wire/BackgroundWorker/Env.hs | Builds Arbiter migration connection string via mkArbiterConnectionString. |
| nix/haskell-pins.nix | Adds arbiter-worker-testkit pin entry. |
| libs/wire-subsystems/wire-subsystems.cabal | Adds postgresql-connection-string dependency to support new conn-str builder. |
| libs/wire-subsystems/src/Wire/JobSubsystem/Migrations.hs | Introduces mkArbiterConnectionString and clarifies migration-lock connection lifecycle. |
| libs/wire-subsystems/src/Wire/JobSubsystem/Interpreter.hs | Updates Arbiter API usage for inserting jobs and query execution. |
| libs/wire-subsystems/src/Wire/JobSubsystem/ArbiterAdapter.hs | Adapts to newer Arbiter MonadArbiter API (Query wrapper, placeholder numbering) and disables listener usage. |
| libs/wire-subsystems/default.nix | Adds postgresql-connection-string to Nix derivation inputs. |
| libs/wire-api/wire-api.cabal | Adds arbiter-core dependency for updated registry typing. |
| libs/wire-api/src/Wire/API/Jobs.hs | Updates JobRegistry to use Queue type from arbiter-core. |
| libs/wire-api/default.nix | Adds arbiter-core to Nix derivation inputs. |
| libs/extended/src/Hasql/Pool/Extended.hs | Removes the old connection-string helper (now provided by wire-subsystems). |
| flake.nix | Bumps Arbiter source revision. |
| flake.lock | Updates Arbiter lock metadata to match new revision. |
| docs/src/developer/reference/config-options.md | Updates operator docs to reflect shared-pool concurrency and removal of LISTEN/NOTIFY connection. |
| changelog.d/0-release-notes/WPB-26489 | Updates release notes to match new connection/pool behavior and migration-lock connection lifecycle. |
blackheaven
approved these changes
Jul 27, 2026
blackheaven
left a comment
Contributor
There was a problem hiding this comment.
Why did you have to upgrade?
Contributor
Author
Then new version offers better use of postgres connections, keeping configuration tuning and overhead for operators to a minimum. |
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.
https://wearezeta.atlassian.net/browse/WPB-27400
Checklist
changelog.d