Skip to content
Discussion options

You must be logged in to vote

What times out isn't waiting for a free connection: you have 3 idle ones. It's the health check sqlx runs on an idle connection before handing it out (test_before_acquire, on by default). That check does I/O, so while it's in flight the runtime has nothing else to do, and with a paused clock tokio auto-advances straight to the next timer, which is the acquire timeout. That's also why a 24 h acquire_timeout "fixes" it: it's no longer the next timer.

For tests with a paused clock, turn the check off on the test pool:

let pool = PgPoolOptions::new()
    .test_before_acquire(false)
    // ...
    .connect(&url)
    .await?;

I reproduced it with sqlx 0.8.6 (SQLite in-memory, 3 idle connections, …

Replies: 2 comments 1 reply

This comment was marked as spam.

@inklesspen
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by inklesspen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants