better errors on reconnect
This commit is contained in:
parent
2970535bac
commit
1aebcd2783
|
@ -50,6 +50,13 @@ Flame graphs make finding slow code painless:
|
||||||
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph
|
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph
|
||||||
|
|
||||||
|
|
||||||
|
## GDB
|
||||||
|
|
||||||
|
Run the proxy under gdb for advanced debugging:
|
||||||
|
|
||||||
|
cargo build --release && RUST_LOG=web3_proxy=debug rust-gdb --args target/debug/web3-proxy --listen-port 7503 --rpc-config-path ./config/production-eth.toml
|
||||||
|
|
||||||
|
|
||||||
## Load Testing
|
## Load Testing
|
||||||
|
|
||||||
Test the proxy:
|
Test the proxy:
|
||||||
|
|
1
TODO.md
1
TODO.md
|
@ -6,6 +6,7 @@
|
||||||
- [ ] when we receive a block, we should store it for later eth_getBlockByNumber, eth_blockNumber, and similar calls
|
- [ ] when we receive a block, we should store it for later eth_getBlockByNumber, eth_blockNumber, and similar calls
|
||||||
- [ ] eth_sendRawTransaction should return the most common result, not the first
|
- [ ] eth_sendRawTransaction should return the most common result, not the first
|
||||||
- [ ] if chain split detected, don't send transactions
|
- [ ] if chain split detected, don't send transactions
|
||||||
|
- [ ] if a rpc fails to connect at start, retry later instead of skipping it forever
|
||||||
- [ ] endpoint for health checks. if no synced servers, give a 502 error
|
- [ ] endpoint for health checks. if no synced servers, give a 502 error
|
||||||
- [ ] move from warp to auxm?
|
- [ ] move from warp to auxm?
|
||||||
- [ ] some production configs are occassionally stuck waiting at 100% cpu
|
- [ ] some production configs are occassionally stuck waiting at 100% cpu
|
||||||
|
|
|
@ -222,6 +222,7 @@ impl Web3Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subscribe to new blocks. If `reconnect` is true, this runs forever.
|
/// Subscribe to new blocks. If `reconnect` is true, this runs forever.
|
||||||
|
/// TODO: instrument with the url
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
pub async fn subscribe_new_heads(
|
pub async fn subscribe_new_heads(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
|
@ -302,13 +303,23 @@ impl Web3Connection {
|
||||||
|
|
||||||
// TODO: what should this timeout be? needs to be larger than worst case block time
|
// TODO: what should this timeout be? needs to be larger than worst case block time
|
||||||
// TODO: although reconnects will make this less of an issue
|
// TODO: although reconnects will make this less of an issue
|
||||||
while let Ok(Some(new_block)) =
|
loop {
|
||||||
timeout_at(Instant::now() + Duration::from_secs(300), stream.next()).await
|
match timeout_at(Instant::now() + Duration::from_secs(300), stream.next())
|
||||||
{
|
.await
|
||||||
self.send_block(Ok(new_block), &block_sender).await;
|
{
|
||||||
|
Ok(Some(new_block)) => {
|
||||||
|
self.send_block(Ok(new_block), &block_sender).await;
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
warn!("subscription ended");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
warn!("subscription ended with an error: {:?}", e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: re-connect!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue