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

fix(stats): v2.2.3 fixes #1127

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
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
28 changes: 25 additions & 3 deletions stats/stats-server/src/blockscout_waiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ fn is_threshold_passed(
.map(|s| s.parse::<f64>())
.transpose()
.context(format!("Parsing `{value_name}`"))?;
let Some(value) = value else {
anyhow::bail!("Received `null` value of `{value_name}`. Can't determine indexing status.",);
};
let value = value.unwrap_or_else(|| {
info!("Treating `{value_name}=null` as zero.",);
0.0
});
if value < threshold {
info!(
threshold = threshold,
Expand Down Expand Up @@ -245,6 +246,27 @@ mod tests {
.expect_err("must time out");
}

#[rstest]
#[tokio::test]
async fn wait_for_blockscout_indexing_works_with_null_ratios(
wait_config: StartConditionSettings,
) {
test_wait_indexing(
wait_config,
Some(Duration::from_millis(300)),
ResponseTemplate::new(200).set_body_string(
r#"{
"finished_indexing": false,
"finished_indexing_blocks": false,
"indexed_blocks_ratio": null,
"indexed_internal_transactions_ratio": null
}"#,
),
)
.await
.expect_err("must time out and not fall with error");
}

#[rstest]
#[tokio::test]
async fn wait_for_blockscout_indexing_retries_with_error_codes(
Expand Down
Loading