-
Notifications
You must be signed in to change notification settings - Fork 8
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
OKX solver update #109
OKX solver update #109
Conversation
src/infra/dex/okx/mod.rs
Outdated
swap_request_future, | ||
self.dex_approved_addresses | ||
.try_get_with(order.sell, approve_transaction_request_future) | ||
.map_err(|_: std::sync::Arc<Error>| Error::CacheEvaluationFailed(order.sell)) |
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.
I had to convert the error from Arc<Error>
to Error
in such a way, because Error
cannot be cloned due to Http error. I think this is enough because in an error situation Http error can be checked by enabling trace level logs for instance.
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.
I see, do you need to specify std::sync::Arc<Error>
? I think just |_|
should do unless you want to make it apparent the error type.
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.
Yes, it is needed because compiler is not resolving automatically error type of the approve_transaction_request_future
. Alternatively I could define return type inside the future like: Ok::<_, Error>(...)
but I thought it looked worse. However now I'm thinking it may be better to define that type in the future, because the future itself provides a hint what is its return type (instead of providing type hint when this future is used by cache).
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.
LGTM
Summary
Addressing PR #104 comments.
Details
lru-cache
crate withmoka
to improve inserting data into the cache (now using segmentation blocking)./swap
and/approve-transaction
requests in parallel to improve latency./approve-transaction
request).How to test
Existing tests and newly added test.