Skip to content
CAI
Software that uses CAICheck a score

mperham/connection_pool

67.9

Adequate · 19 September 2026

459

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Ruby library that manages connection pooling for multithreaded and multi-process applications. It provides a robust API for initializing pools with configurable timeouts and sizes, while ensuring resource safety through automatic connection discarding and fork-aware cleanup. The library supports lazy connection creation, graceful shutdowns, and per-invocation timeout overrides to handle concurrent access efficiently.

Behavioural changes

Connection pool API overhaul with discard and wrapper support

The connection pool library has been significantly refactored, changing the initialization signature to use keyword arguments (timeout, size, auto\_reload\_after\_fork) and introducing a new Wrapper class accessible via ConnectionPool.wrap. A key behavioral change is the addition of discard\_current\_connection, allowing threads to mark invalid connections for disposal rather than returning them to the pool. The API also now supports per-invocation timeout overrides via the with method and automatically reloads connections after a fork by default.

lib · high confidence

Connection pool major version bump to 3.0.2 with fork safety and lazy stack

The connection pool library has been updated to version 3.0.2, introducing significant behavioral changes to resource management and process safety. A new \lib/connection\_pool/fork.rb\ module ensures that checked-out connections are properly checked in and closed after a process fork, preventing stale resource usage in multi-process environments. The internal \TimedStack\ implementation has been refactored to support lazy connection creation and includes a new \shutdown\ method for graceful teardown, while the legacy \TimedQueue\ class has been removed in favor of the new stack-based approach. Additionally, a \Wrapper\ class is now available to provide a simplified interface for common pool operations like \with\, \pool\_size\, and \pool\_available\.

_lib/connection\pool · high confidence

Test coverage

Added comprehensive test suite and benchmarking infrastructure

Added a new test suite covering the ConnectionPool and TimedStack components, including tests for multithreaded usage, timeout handling, stack operations (push, pop, shutdown, reload), and subclassing overrides. Also added a benchmark script to measure ConnectionPool\#with performance and a test helper to manage instance reset and warning suppression.

test · high confidence

Dependencies

Update Ruby version requirement and add development dependencies

The gem now requires Ruby 3.2.0 or higher, dropping support for older versions. Development dependencies have been added to the gemspec, including bundler, maxitest, minitest-mock, and rake, while the Gemfile has been updated to include standard, benchmark-ips, maxitest, and simplecov for local development and testing.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 68.

Lenses

  • Code Health 100
  • Architecture 69
  • Maturity 57
  • Readiness 75
  • Security 96

Changes since last survey

  • 300 commits — 276 feature/other, 24 fixes

By area

  • (root) — 101 commits
  • lib/connection_pool — 45 commits
  • lib/connection_pool.rb — 41 commits
  • test/test_connection_pool.rb — 37 commits
  • (repo) — 31 commits
  • test/test_connection_pool_timed_stack.rb — 15 commits
  • .github/workflows — 14 commits
  • test/helper.rb — 11 commits
  • lib/timed_queue.rb — 2 commits
  • test/test_timed_stack_subclassing.rb — 2 commits
  • .github/dependabot.yml — 1 commit

Notable commits

  • fix: Fix JRuby non-determinism
  • fix: Fix MiniTest name.
  • fix: Fix argument forwarding in Ruby 2.7 (#149)
  • fix: Fix cross-test contamination
  • fix: Fix missing fork.rb
  • fix: Fix old obsolete rdoc
  • fix: Fix requires, making sure we don't accidentally load the gem.
  • fix: Fix travis configuration
  • fix: Integrate standard gem, code formatting fixes, no functional changes
  • fix: Merge pull request #73 from mylesmegyesi/fix-created-counter-when-object-creation-fails
  • fix: Merge pull request #76 from mperham/attempt-to-fix-rubinius
  • fix: Ractor fixes, freeze and dont reference constants if we dont need to
  • fix: Rejigger exceptions, fixes #130
  • fix: Revert "Fix MiniTest name." since it was intentional.
  • fix: Revert "Use prerelease aware version comparison (#157)"
  • fix: Style fixes
  • fix: Support pop(exception: false) to avoid exceptions as control flow, fixes #207
  • fix: fix CI warning
  • fix: fix jruby
  • fix: fix jruby
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

mperham/connection_pool was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5a3d762481b9ec46b7cfdf643f8597bd3fc5f02d — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.