File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,10 @@ use crate::error::Error;
12
12
use super :: inner:: { is_beyond_max_lifetime, PoolInner } ;
13
13
use crate :: pool:: connect:: { ConnectPermit , ConnectionId } ;
14
14
use crate :: pool:: options:: PoolConnectionMetadata ;
15
+ use crate :: rt;
15
16
use std:: future:: Future ;
16
17
18
+ const RETURN_TO_POOL_TIMEOUT : Duration = Duration :: from_secs ( 5 ) ;
17
19
const CLOSE_ON_DROP_TIMEOUT : Duration = Duration :: from_secs ( 5 ) ;
18
20
19
21
/// A connection managed by a [`Pool`][crate::pool::Pool].
@@ -149,7 +151,9 @@ impl<DB: Database> PoolConnection<DB> {
149
151
150
152
async move {
151
153
let returned_to_pool = if let Some ( floating) = floating {
152
- floating. return_to_pool ( ) . await
154
+ rt:: timeout ( RETURN_TO_POOL_TIMEOUT , floating. return_to_pool ( ) )
155
+ . await
156
+ . unwrap_or ( false )
153
157
} else {
154
158
false
155
159
} ;
You can’t perform that action at this time.
0 commit comments