Skip to content

Commit

Permalink
Remove redundant sleep (#670)
Browse files Browse the repository at this point in the history
* Remove unnecessary sleep

* log error message before returning

* print error message using error macro
  • Loading branch information
rakanalh authored Jun 6, 2024
1 parent 9dc4cd0 commit 7270755
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,9 @@ where
match inner_client.get_soft_batch::<Da::Spec>(l2_height).await {
Ok(Some(soft_batch)) => Ok(soft_batch),
Ok(None) => {
debug!(
"Soft Batch: no batch at height {}, retrying...",
l2_height
);
debug!("Soft Batch: no batch at height {}", l2_height);

// We wait for 2 seconds and then return a Permanent error so that we exit the retry.
// This should not backoff exponentially
sleep(Duration::from_secs(2)).await;
// Return a Permanent error so that we exit the retry.
Err(backoff::Error::Permanent(
"No soft batch published".to_owned(),
))
Expand All @@ -440,19 +435,23 @@ where
"Soft Batch: connection error during RPC call: {:?}",
e
);
debug!(error_msg);
error!(error_msg);
Err(backoff::Error::Transient {
err: error_msg,
retry_after: None,
})
}
_ => Err(backoff::Error::Transient {
err: format!(
_ => {
let error_msg = format!(
"Soft Batch: unknown error from RPC call: {:?}",
e
),
retry_after: None,
}),
);
error!(error_msg);
Err(backoff::Error::Transient {
err: error_msg,
retry_after: None,
})
}
},
}
})
Expand Down

0 comments on commit 7270755

Please sign in to comment.