File tree Expand file tree Collapse file tree 2 files changed +95
-80
lines changed
Expand file tree Collapse file tree 2 files changed +95
-80
lines changed Original file line number Diff line number Diff line change @@ -351,14 +351,31 @@ impl ManageConnection for ServerPool {
351351 self . address, self . user. name
352352 ) ;
353353
354- Server :: startup (
354+ // Put a temporary process_id into the stats
355+ // for server login.
356+ let process_id = rand:: random :: < i32 > ( ) ;
357+ self . stats . server_login ( process_id) ;
358+
359+ match Server :: startup (
355360 & self . address ,
356361 & self . user ,
357362 & self . database ,
358363 self . client_server_map . clone ( ) ,
359364 self . stats . clone ( ) ,
360365 )
361366 . await
367+ {
368+ Ok ( conn) => {
369+ // Remove the temporary process_id from the stats.
370+ self . stats . server_disconnecting ( process_id) ;
371+ Ok ( conn)
372+ }
373+ Err ( err) => {
374+ // Remove the temporary process_id from the stats.
375+ self . stats . server_disconnecting ( process_id) ;
376+ Err ( err)
377+ }
378+ }
362379 }
363380
364381 /// Determines if the connection is still connected to the database.
You can’t perform that action at this time.
0 commit comments