-
Notifications
You must be signed in to change notification settings - Fork 83
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
Reconnect L1 WS stream if disconnected #2287
Conversation
types/src/v0/impls/l1.rs
Outdated
}) | ||
} | ||
|
||
async fn stop(&self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this only stops the reconnect functionality, but the L1 connection is still reachable. Maybe it should be renamed to something more appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it stops all the background tasks (the reconnect task and the snapshot updating task). Ideally this would take self
by value and just destroy the whole client but it's not easy to implement like that because L1 client is behind an Arc
in NodeState
.
Maybe like shut_down_tasks
, and also rename start
to spawn_tasks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me
Ethers internally tries to reconnect once, but if that fails, it gives up and shuts down the whole provider backend. This is not good in the case of extended outages of the L1 server. This change handles errors from the underlying RPC client indicating that the connection is closed by spawning a task to reestablish the connection. This task tries until it succceeds.
380c01c
to
d4388a0
Compare
Ethers internally tries to reconnect once, but if that fails, it gives up and shuts down the whole provider backend. This is not good in the case of extended outages of the L1 server.
This PR:
Key places to review:
RpcClient::request
RpcClient::drop
,L1Client::stop
Things tested
New regression tests fail before this change