Skip to content

Expose in-flight acquisitions in pool statistics - #10660

Merged
tim-smart merged 3 commits into
v4/next-minorfrom
agent/effect-bot/273808d0e8e2
Nov 16, 2026
Merged

tim-smart merged 3 commits into
v4/next-minorfrom
agent/effect-bot/273808d0e8e2

Conversation

@effect-bot

@effect-bot effect-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add Pool.Stats.acquiring, counting started acquisition effects independently of borrowers, including pre-warming and replacements.
  • Transfer successful acquisitions to the item set synchronously; clear the count on failure or interruption without double-decrementing.
  • Preserve PgPool/PgClient pass-through stats and report acquiring: 0 for makeClient's already-connected session.
  • Document independent pending/acquiring counts and the fact that zero occupancy does not guarantee completed finalizers or socket shutdown.

Validation

All toolchain commands run through nix develop -c:

  • pnpm test --run packages/effect/test/Pool.test.ts packages/sql/pg/test/PgPool.in-process.test.ts — 77 passed on v4/next-minor (83 passed on the original main base)
  • pnpm check — passed
  • pnpm jsdocs --check — passed
  • pnpm lint-fix and pnpm lint — passed
  • git diff --check — passed

The first commit is the tests-only red phase (9 expected failures, 74 passes); the second supplies implementation, documentation, and a consolidated minor changeset for effect and @effect/sql-pg. Manually authored Stats snapshots now require acquiring. The counter is private to PoolImpl; the stable Pool.State interface is unchanged. Custom strategies can read the count through Pool.stats.

Review handoff

Ready for independent review and the Architect simplification pass. Releasing counts and lifecycle callbacks are deliberately out of scope.

Closes #10650
Closes EFF-3813

Release target correction

The release queue selects v4/next-minor for the minor changeset. Rebased only the two feature commits onto that target; git range-diff confirms both patches are unchanged. The PR now contains five intended files, not unrelated main history. Revalidated targeted tests (77), typecheck, JSDoc, lint, and diff whitespace on this base.

Simplification follow-up

Kept the acquisition counter on a private symbol rather than widening stable Pool.State, and trimmed duplicated documentation. Retained the regression test’s public Pool.stats polling instead of coupling it to state.items. Retained the pending/acquiring double-counting caveat because it warns against summing two different metrics. Minor changeset and release target unchanged. All 77 targeted tests, pnpm check, pnpm lint, pnpm jsdocs --check, and git diff --check pass.

@changeset-bot

changeset-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 59bbe6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Minor
@effect/sql-pg Minor
@effect/opentelemetry Minor
@effect/vitest Minor
@effect/ai-anthropic Minor
@effect/ai-cloudflare Minor
@effect/ai-openai-compat Minor
@effect/ai-openai Minor
@effect/ai-openrouter Minor
@effect/ai-typesafe Minor
@effect/atom-react Minor
@effect/atom-solid Minor
@effect/atom-vue Minor
@effect/platform-browser Minor
@effect/platform-bun Minor
@effect/platform-deno Minor
@effect/platform-node-shared Minor
@effect/platform-node Minor
@effect/sql-clickhouse Minor
@effect/sql-d1 Minor
@effect/sql-libsql Minor
@effect/sql-mssql Minor
@effect/sql-mysql2 Minor
@effect/sql-pglite Minor
@effect/sql-sqlite-bun Minor
@effect/sql-sqlite-do Minor
@effect/sql-sqlite-node Minor
@effect/sql-sqlite-react-native Minor
@effect/sql-sqlite-wasm Minor
@effect/docgen Minor
@effect/doctest Minor
@effect/graphql-generator Minor
@effect/openapi-generator Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-bot
effect-bot changed the base branch from main to v4/next-minor November 15, 2026 22:27
@effect-bot
effect-bot force-pushed the agent/effect-bot/273808d0e8e2 branch from 9f4ade2 to 3ffda30 Compare November 15, 2026 22:35
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.71 KB 39.71 KB 0.00 KB (0.00%)
basic.ts 7.35 KB 7.35 KB 0.00 KB (0.00%)
batching.ts 11.29 KB 11.29 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.83 KB 11.83 KB 0.00 KB (0.00%)
config.ts 23.16 KB 23.16 KB 0.00 KB (0.00%)
differ.ts 22.30 KB 22.30 KB 0.00 KB (0.00%)
http-client.ts 27.51 KB 27.51 KB 0.00 KB (0.00%)
http-router.ts 37.23 KB 37.23 KB 0.00 KB (0.00%)
logger.ts 12.28 KB 12.28 KB 0.00 KB (0.00%)
metric.ts 9.74 KB 9.74 KB 0.00 KB (0.00%)
optic.ts 7.21 KB 7.21 KB 0.00 KB (0.00%)
pubsub.ts 16.34 KB 16.34 KB 0.00 KB (0.00%)
queue.ts 13.20 KB 13.20 KB 0.00 KB (0.00%)
schedule.ts 12.07 KB 12.07 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.33 KB 14.33 KB 0.00 KB (0.00%)
schema-binary.ts 42.48 KB 42.48 KB 0.00 KB (0.00%)
schema-class.ts 22.05 KB 22.05 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.00 KB 30.00 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.32 KB 28.32 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.64 KB 15.64 KB 0.00 KB (0.00%)
schema-string.ts 12.53 KB 12.53 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.51 KB 16.51 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.26 KB 39.26 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.46 KB 26.46 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.21 KB 21.21 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.38 KB 21.38 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.47 KB 21.47 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.47 KB 26.47 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.54 KB 21.54 KB 0.00 KB (0.00%)
schema.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
stm.ts 14.50 KB 14.50 KB 0.00 KB (0.00%)
stream.ts 10.66 KB 10.66 KB 0.00 KB (0.00%)
supervisor.ts 11.61 KB 11.61 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit 664bebc into v4/next-minor Nov 16, 2026
14 checks passed
@tim-smart
tim-smart deleted the agent/effect-bot/273808d0e8e2 branch November 16, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pool.stats: count items whose acquisition is still running

2 participants