Skip to content

Commit

Permalink
Adding address to be removed from the refresh_connection instead from…
Browse files Browse the repository at this point in the history
… the tokio refresh task

Signed-off-by: GilboaAWS <[email protected]>
  • Loading branch information
GilboaAWS committed Jan 12, 2025
1 parent a12837a commit 7b84fb0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions glide-core/redis-rs/redis/src/cluster_async/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,16 @@ where
let address_clone = address.clone();
let address_clone_for_task = address.clone();

// Add this address to be removed in poll_flush so all requests see a consistent connection map.
// See next comment for elaborated explanation.
inner_clone
.conn_lock
.write()
.expect(MUTEX_READ_ERR)
.refresh_conn_state
.refresh_addresses_started
.insert(address_clone_for_task.clone());

let handle = tokio::spawn(async move {
info!(
"Refreshing connection task to {:?} started",
Expand All @@ -1415,16 +1425,6 @@ where
None
};

// Add this address to be removed in poll_flush so all requests see a consistent connection map.
// See next comment for elaborated explanation.
inner_clone
.conn_lock
.write()
.expect(MUTEX_READ_ERR)
.refresh_conn_state
.refresh_addresses_started
.insert(address_clone_for_task.clone());

let mut cluster_params = inner_clone
.cluster_params
.read()
Expand Down Expand Up @@ -2549,6 +2549,9 @@ where
}
}
}
else {
debug!("update_refreshed_connection: address {:?} current_existing_addresses_in_slot_map: {:?}", address, current_existing_addresses_in_slot_map);
}

// Remove this address from refresh_addresses_done
self.inner
Expand Down

0 comments on commit 7b84fb0

Please sign in to comment.