Skip to content

Commit

Permalink
testing if this would fix tests
Browse files Browse the repository at this point in the history
disconnecting like that broke a lot of requests, we probably shouldn't
disconnect from some thread since we don't know if another thread is
holding the connection to use it
  • Loading branch information
mariocynicys committed Sep 12, 2024
1 parent f9866b1 commit d98fd21
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions mm2src/coins/utxo/rpc_clients/electrum_rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl ElectrumClient {
.electrum_request(json, request.rpc_id(), ELECTRUM_REQUEST_TIMEOUT)
.await?;
// Inform the connection manager that the connection was queried and no longer needed now.
self.connection_manager.not_needed(&to_addr).await;
// self.connection_manager.not_needed(&to_addr).await;

Ok(response)
}
Expand Down Expand Up @@ -413,25 +413,25 @@ impl ElectrumClient {
final_response = Some((address, response));
}
if disconnect_immediately {
connection
.disconnect(Some(ElectrumConnectionErr::Temporary(
"Was used as a fallback and not needed now.".to_string(),
)))
.await;
event_handlers.on_disconnected(connection.address()).ok();
// connection
// .disconnect(Some(ElectrumConnectionErr::Temporary(
// "Was used as a fallback and not needed now.".to_string(),
// )))
// .await;
// event_handlers.on_disconnected(connection.address()).ok();
}
if !send_to_all && final_response.is_some() {
return Ok(final_response.unwrap());
}
},
Err(e) => {
warn!("Error while sending request to {address:?}: {e:?}");
connection
.disconnect(Some(ElectrumConnectionErr::Temporary(format!(
"Forcefully disconnected for erroring: {e:?}."
))))
.await;
event_handlers.on_disconnected(connection.address()).ok();
// connection
// .disconnect(Some(ElectrumConnectionErr::Temporary(format!(
// "Forcefully disconnected for erroring: {e:?}."
// ))))
// .await;
// event_handlers.on_disconnected(connection.address()).ok();
errors.push((address, e))
},
}
Expand Down

0 comments on commit d98fd21

Please sign in to comment.