Rate-limit Dex solver solver requests #2068
Labels
E:3.1 Driver Colocation
See https://github.com/cowprotocol/pm/issues/14 for details
good first issue
Good for newcomers
The Dex solver (1Inch, Paraswap, 0x) is implemented in a way that it attempts to find a solution to each order in the batch individually (default batch size is 1)
services/crates/solvers/src/domain/solver/dex/mod.rs
Lines 73 to 87 in 148a922
However, it does not respect or feed-back if the API returns rate-limit errors, which can be seen in the logs here.
In this case, instead of continuing to hammer the API with requests (and causing other consumers to have less API capacity), it should back off and try again after a cool down period.
Suggested Chages
solvers::infra::dex::Error
shared::rate_limiter::RateLimiter
insidedomain::solver::dex
when solving the single ordersGiven that the new infra should not directly depend on the shared crate, we can either reimplement the rate_limiter logic or pass it through a boundary struct (similar to how e.g. the
boundary::baseline
has access to theshared::baseline_solver
)The text was updated successfully, but these errors were encountered: