Skip to content

Conversation

gwynne
Copy link
Member

@gwynne gwynne commented Aug 25, 2025

These changes are now available in 2.11.0

AsyncKit 1.21.0 added support for automatic pruning of idle database connections in the connection pool. This PR adds the necessary configuration parameters to the Postgres driver, enabling Fluent users to take advantage of this new functionality:

app.databases.use(.postgres(
    url: "postgres://user@pass:host/db",
    pruningInterval: .minutes(1),
    maxIdleTimeBeforePruning: .minutes(10)
), as: .psql)

The pruningInterval controls how often the pool will check for idle connections; specifying nil disables idle pruning entirely. The maxIdleTimeBeforePruning controls how long a connection must go unused before being pruned.

@gwynne gwynne requested review from 0xTim, MahdiBM and ptoffy August 25, 2025 17:01
@gwynne gwynne added the semver-minor Contains new APIs label Aug 25, 2025
@gwynne gwynne force-pushed the support-idle-pruning branch from ace9e0b to 3c55d3c Compare August 25, 2025 17:13
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 8.53659% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.23%. Comparing base (fd57101) to head (dc0d053).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ntPostgresDriver/FluentPostgresConfiguration.swift 6.25% 75 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
- Coverage   63.39%   54.23%   -9.16%     
==========================================
  Files           8        8              
  Lines         336      437     +101     
==========================================
+ Hits          213      237      +24     
- Misses        123      200      +77     
Files with missing lines Coverage Δ
.../FluentPostgresDriver/FluentPostgresDatabase.swift 80.21% <100.00%> (-0.87%) ⬇️
...uentPostgresDriver/PostgresConverterDelegate.swift 88.09% <100.00%> (ø)
...ntPostgresDriver/FluentPostgresConfiguration.swift 20.68% <6.25%> (-16.08%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…pruning support in AsyncKit 1.21.0, enabling direct use by Fluent users.
@gwynne gwynne force-pushed the support-idle-pruning branch from 3c55d3c to d889fe8 Compare August 25, 2025 17:23
@gwynne gwynne merged commit cd47a70 into main Aug 26, 2025
5 checks passed
@gwynne gwynne deleted the support-idle-pruning branch August 26, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor Contains new APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants