-
Notifications
You must be signed in to change notification settings - Fork 25
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
services err handling with backoff when overloaded #39
Conversation
0ee80e5
to
dd4299d
Compare
Why does this need to be added to the socket handling in
Does that not work? Should we document it better? |
@hdevalence unless I'm missing something, I don't think there is any way to handle this in an app. When a service call fails, the error ends up panicking in the unwrap in Unrelated, I realized that the changes here will force flushing after every request which is not ideal, so I'll try to improve that. |
Surprised by this change as well, besides @hdevalence point that this is probably not the right point of integration I'd like to understand the motivation better. Could you outline a scenario where backoff/retry is improving QoS between the app and CometBFT while not violating the protocol? |
@xla Say you e.g. set |
Looking back at the code, I think the most reasonable thing would probably be to only shed info request (and maybe also snapshot) on overload by returning exception response without doing any backoff. For mempool service, it seems that |
closing in favor of #40 |
This PR adds:
Exception
response)To achieve this, the socket's stream and sink must be held across await points to keep them alive, so I ended up wrapping them in
std::sync::Mutex
though the access should always be exclusive anyway. Additionally, the request stream is made peekable so that we're not removing requests that must be handled and only popped once a service call is successful.