-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic in sqlx_core::pool::connection::Floating<DB,sqlx_core::pool::connection::Idle<DB>>::metadata #1912
Comments
sqlx should probably use saturating_duration_since instead of duration_since in See: https://doc.rust-lang.org/std/time/struct.Instant.html#monotonicity |
No, I'm dumb. These need to be reversed: https://github.com/launchbadge/sqlx/blob/main/sqlx-core/src/pool/connection.rs#L328-L329 So PoolConnectionMetadata {
age: now.duration_since(self.created_at),
idle_for: now.duration_since(self.idle_since),
} The receiver of the method is supposed to be the later |
Well, actually, looking at the code: it looks like the subtraction is done in the wrong order ! |
You beat me to it :) |
I think the main takeaway is rather: there should have been a test catching that 😉 |
This code was obviously not executed a single time before being published on crates.io... |
Yeah, I meant to add a test but forgot. |
When using
PoolOptions::before_acquire
, I got a panic crashing my entire server with the following error:The text was updated successfully, but these errors were encountered: