mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 14:55:41 +00:00
Reconnect on-demand clients from MessagesSource::reconnect and MessagesTarget::reconnect (#1927)
* reconnect on-demand clients from MessagesSource::reconnect and MessagesTarget::reconnect * add issue reference * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
3a145e5844
commit
61e00a56c0
@@ -129,8 +129,22 @@ impl<P: SubstrateMessageLane> RelayClient for SubstrateMessagesSource<P> {
|
||||
type Error = SubstrateError;
|
||||
|
||||
async fn reconnect(&mut self) -> Result<(), SubstrateError> {
|
||||
// since the client calls RPC methods on both sides, we need to reconnect both
|
||||
self.source_client.reconnect().await?;
|
||||
self.target_client.reconnect().await
|
||||
self.target_client.reconnect().await?;
|
||||
|
||||
// call reconnect on on-demand headers relay, because we may use different chains there
|
||||
// and the error that has lead to reconnect may have came from those other chains
|
||||
// (see `require_target_header_on_source`)
|
||||
//
|
||||
// this may lead to multiple reconnects to the same node during the same call and it
|
||||
// needs to be addressed in the future
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1928
|
||||
if let Some(ref mut target_to_source_headers_relay) = self.target_to_source_headers_relay {
|
||||
target_to_source_headers_relay.reconnect().await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user