Skip to content

Conversation

@LeoPatOZ
Copy link
Collaborator

Resolves #167

(and hopefully #170)

@LeoPatOZ LeoPatOZ force-pushed the add-robust-subscription branch from efd857d to e6b1455 Compare November 11, 2025 11:32
ref: better comments

fix: remove bracket
@LeoPatOZ LeoPatOZ force-pushed the add-robust-subscription branch from e6b1455 to 71a3b3b Compare November 11, 2025 11:34
@LeoPatOZ LeoPatOZ changed the base branch from main to refactor-robust-provider November 12, 2025 14:09
Base automatically changed from refactor-robust-provider to main November 13, 2025 10:17
Comment on lines +511 to +512
let block = stream.next().await.unwrap()?;
assert_eq!(1, block.number());
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can't use assert_next!?

}

#[tokio::test]
async fn test_robust_subscription_stream_with_failover() -> anyhow::Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need a test case that shows that the scanner occasionally tries the primary provider.

Maybe something like:

  1. Spawn anvil_1
  2. Connect provider_1
  3. Store anvil_1.port() in a local variable anvil_1_port
  4. Spawn anvil_2
  5. Connect provider_2
  6. Mint block on anvil_1, assert
  7. Drop anvil_1
  8. Mint block on anvil_2, assert stream still works
  9. Spawn new anvil_3 with .port(anvil_1_port) <- this will ensure provider_1 ws_endpoint_url is again valid
  10. ???
  11. Verify that scanner switches back to provider_1

Ok(())
}

#[tokio::test]
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Add test with multiple pubsub fallbacks, where each works but then stops, to confirm scanner goes through all of them in turn.
  2. Add subscribe test with no fallbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Scanner Live/Sync Modes Should Handle Subscriptions That Lag or Get Closed

3 participants