-
Notifications
You must be signed in to change notification settings - Fork 93
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
Simplify deadline passing #2222
Conversation
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.
Since you removed timeout.reduce(self.config.timeouts.http_delay)
I think you need to implement that on solvers
side otherwise baseline and dex solvers will hit the deadline every time.
Good point! Opened https://github.com/cowprotocol/solvers/pull/8 and will add it for baseline here. |
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.
Even though we have
1s
reduce time for external solvers in http_solver, I believe we should lower the timeout for them also as we did for baseline/dex, because if external solvers do not respecttime_limit
it means that the timeout error will not get properly propagated back to theautopilot
, bothdriver
andautopilot
will time out at the same time - whileautopilot
expectsno solutions
in this case.Each
timeout
error received byautopilot
should mean we have a bug.
Edit: I think I am wrong, we will have leftover time in driver
to process the response back. All good.
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.
Nice change. Really happy you killed the SolverTimeout
.
…rvices into simplify_deadline_passing
Description
There seems to be an issue with the deadline we are passing down to solvers leading to timeouts while still having significant time left for postprocessing. Take Laertes in barn auction 8222857 for instance:
Here we aborted solver computation at 09:37:58 despite the original solver deadline (first log) being almost two seconds later (09:38:00). We can see that the deadline that is received by the solver engine is already much smaller than what we computed in the driver. Looking at the code we expect a reduction of
http_delay
(0.5s) but not 2s.One thing to note is that the way we pass down solver deadlines is surprisingly 🤡. We convert it into a duration to later on convert it into a timestamp again. My hunch is that this is causing us to lose precision and thus time. This PR simplifies this logic and hopes that this will resolve the 2s time loss.
Changes
remaining
helper method into an extension trait to allow it being used where neededWe already have a buffer for postprocessing in the driver, and really it should be the consumer (solver engine in this case) who adjusts the deadline to take network latency into account. We do the same for the autopilot<>driver deadline (the driver attempts to send their response 500ms before the deadline) and in fact also already account for another 1s buffer inside the legacy solver-engine (code)
How to test
Existing tests
Related Issues
Fixes #2211