Skip to content

Commit 07f5939

Browse files
wip
1 parent 021a2ff commit 07f5939

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/modules/db/sqlx/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,13 @@ impl SqlxConnection {
682682
let con_str = format!("{protocol_type}://{user}:{pass}@{host}:{port}{db}");
683683

684684
// see if we have a wrapper with the correct con_str
685-
let map = &mut *POOLS.lock().expect("could not lock mutex");
685+
{
686+
let map = &mut *POOLS.lock().expect("could not lock mutex");
686687

687-
if let Some(con_ref) = map.get(&con_str) {
688-
if let Some(con_arc) = con_ref.upgrade() {
689-
return Ok(con_arc);
688+
if let Some(con_ref) = map.get(&con_str) {
689+
if let Some(con_arc) = con_ref.upgrade() {
690+
return Ok(con_arc);
691+
}
690692
}
691693
}
692694

@@ -741,6 +743,7 @@ impl SqlxConnection {
741743

742744
// register con in pools
743745
let arc = Arc::new(con);
746+
let map = &mut *POOLS.lock().expect("could not lock mutex");
744747
map.insert(con_str2, Arc::downgrade(&arc));
745748
// return arc
746749
Ok(arc)

0 commit comments

Comments
 (0)