@@ -66,7 +66,7 @@ impl GetConnInner {
66
66
#[ derive( Debug ) ]
67
67
#[ must_use = "futures do nothing unless you `.await` or poll them" ]
68
68
pub struct GetConn {
69
- pub ( crate ) queue_id : Option < QueueId > ,
69
+ pub ( crate ) queue_id : QueueId ,
70
70
pub ( crate ) pool : Option < Pool > ,
71
71
pub ( crate ) inner : GetConnInner ,
72
72
reset_upon_returning_to_a_pool : bool ,
@@ -77,7 +77,7 @@ pub struct GetConn {
77
77
impl GetConn {
78
78
pub ( crate ) fn new ( pool : & Pool , reset_upon_returning_to_a_pool : bool ) -> GetConn {
79
79
GetConn {
80
- queue_id : None ,
80
+ queue_id : QueueId :: next ( ) ,
81
81
pool : Some ( pool. clone ( ) ) ,
82
82
inner : GetConnInner :: New ,
83
83
reset_upon_returning_to_a_pool,
@@ -112,7 +112,7 @@ impl Future for GetConn {
112
112
loop {
113
113
match self . inner {
114
114
GetConnInner :: New => {
115
- let queue_id = * self . queue_id . get_or_insert_with ( QueueId :: next ) ;
115
+ let queue_id = self . queue_id ;
116
116
let next = ready ! ( Pin :: new( self . pool_mut( ) ) . poll_new_conn( cx, queue_id) ) ?;
117
117
match next {
118
118
GetConnInner :: Connecting ( conn_fut) => {
@@ -185,9 +185,7 @@ impl Drop for GetConn {
185
185
if let Some ( pool) = self . pool . take ( ) {
186
186
// Remove the waker from the pool's waitlist in case this task was
187
187
// woken by another waker, like from tokio::time::timeout.
188
- if let Some ( queue_id) = self . queue_id {
189
- pool. unqueue ( queue_id) ;
190
- }
188
+ pool. unqueue ( self . queue_id ) ;
191
189
if let GetConnInner :: Connecting ( ..) = self . inner . take ( ) {
192
190
pool. cancel_connection ( ) ;
193
191
}
0 commit comments