Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ICRC_Rosetta): FI-1699: Bump the retry limit #4446

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions rs/rosetta-api/icrc1/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ impl RosettaClient {
let request = SearchTransactionsRequest::builder(network_identifier.clone())
.with_transaction_identifier(submit_response.transaction_identifier.clone())
.build();
while tries < 10 {
const MAX_RETRIES: u64 = 30;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is a change in the production code, not test code. Another option could be to allow specifying this value as a configuration option?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a downside to increasing the limit in prod?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!

Another thought I had was to split the functionality of make_submit_and_wait_for_transaction into make_submit and wait_for_transaction methods, and then the caller could decide how often and for how long they would call wait_for_transaction if the transaction doesn't get added to the blockchain. The methods called internally in make_submit_and_wait_for_transaction seem to all be public, so a caller could already now mimic the functionality - we could also consider doing that in the tests.

Maybe @fsodre has some views?

while tries < MAX_RETRIES {
let transaction = self.search_transactions(&request).await?;
if !transaction.transactions.is_empty() {
return Ok(submit_response);
Expand All @@ -190,7 +191,11 @@ impl RosettaClient {
}

Err(Error::unable_to_find_block(
&"Transaction was not added to the blockchain after 10 seconds".to_owned(),
&format!(
"Transaction was not added to the blockchain after {} seconds",
MAX_RETRIES
)
.to_owned(),
))
}

Expand Down