-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transaction retry service (#1029)
* Add transaction retry service * fix signature * fix comments * fix tracing error
- Loading branch information
Showing
4 changed files
with
42 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::eth_provider::provider::EthDataProvider; | ||
use tokio::time::{sleep, Duration}; | ||
|
||
pub async fn start_retry_service<SP>(eth_provider: EthDataProvider<SP>) | ||
where | ||
SP: starknet::providers::Provider + Send + Sync, | ||
{ | ||
// Start an infinite loop. | ||
loop { | ||
// Call the retry_transactions method | ||
if let Err(err) = eth_provider.retry_transactions().await { | ||
tracing::error!("Error while retrying transactions: {:?}", err); | ||
} | ||
// 30-second pause | ||
sleep(Duration::from_secs(30)).await; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters