Skip to content

Conversation

@gwynne
Copy link
Member

@gwynne gwynne commented Aug 25, 2025

These changes are now available in 4.8.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 MySQL driver, enabling Fluent users to take advantage of this new functionality:

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

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:19
@gwynne gwynne added the semver-minor Contains new APIs label Aug 25, 2025
@gwynne gwynne force-pushed the support-idle-pruning branch from aa5501c to 2f5ffd5 Compare August 25, 2025 17:23
@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.18%. Comparing base (c1422fd) to head (29febb9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #230      +/-   ##
==========================================
+ Coverage   97.61%   98.18%   +0.56%     
==========================================
  Files           7        7              
  Lines         252      331      +79     
==========================================
+ Hits          246      325      +79     
  Misses          6        6              
Files with missing lines Coverage Δ
...s/FluentMySQLDriver/FluentMySQLConfiguration.swift 100.00% <100.00%> (ø)
...ources/FluentMySQLDriver/FluentMySQLDatabase.swift 97.97% <100.00%> (+0.17%) ⬆️
🚀 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 2f5ffd5 to 58e187d Compare August 25, 2025 17:31
@gwynne gwynne merged commit 4d8f31a into main Aug 26, 2025
20 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