mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
Auto relay exchange transactions (#227)
* auto relay exchange transactions * docker + auto-relay-tx * clippy * jsonrpsee in Cargo.lock ??? * fix tests compilation * Show sccache * mute clippy * move * Update relays/ethereum/src/exchange.rs Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com> * finish comment * (bool, String) -> StringifiedMaybeConnectionError * Update deployments/rialto/docker-compose.yml Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com> Co-authored-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com> Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
This commit is contained in:
committed by
Bastian Köcher
parent
112eb86b8f
commit
c4424e5b73
@@ -20,6 +20,7 @@ use crate::sync_loop_metrics::SyncLoopMetrics;
|
||||
use crate::sync_types::{
|
||||
HeaderIdOf, HeaderStatus, HeadersSyncPipeline, MaybeConnectionError, QueuedHeader, SubmittedHeaders,
|
||||
};
|
||||
use crate::utils::retry_backoff;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use backoff::{backoff::Backoff, ExponentialBackoff};
|
||||
@@ -48,9 +49,6 @@ const BACKUP_STALL_SYNC_TIMEOUT: Duration = Duration::from_secs(10 * 60);
|
||||
/// Delay after connection-related error happened before we'll try
|
||||
/// reconnection again.
|
||||
const CONNECTION_ERROR_DELAY: Duration = Duration::from_secs(10);
|
||||
/// Max delay after connection-unrelated error happened before we'll try the
|
||||
/// same request again.
|
||||
const MAX_BACKOFF_INTERVAL: Duration = Duration::from_secs(60);
|
||||
|
||||
/// Source client trait.
|
||||
#[async_trait]
|
||||
@@ -569,15 +567,6 @@ fn interval(timeout: Duration) -> impl futures::Stream<Item = ()> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Exponential backoff for connection-unrelated errors retries.
|
||||
pub(crate) fn retry_backoff() -> ExponentialBackoff {
|
||||
let mut backoff = ExponentialBackoff::default();
|
||||
// we do not want relayer to stop
|
||||
backoff.max_elapsed_time = None;
|
||||
backoff.max_interval = MAX_BACKOFF_INTERVAL;
|
||||
backoff
|
||||
}
|
||||
|
||||
/// Process result of the future from a client.
|
||||
///
|
||||
/// Returns whether or not the client we're interacting with is online. In this context
|
||||
|
||||
Reference in New Issue
Block a user