-
Notifications
You must be signed in to change notification settings - Fork 47
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
refactor(async): refactoring async client and minor documentation improvements #93
refactor(async): refactoring async client and minor documentation improvements #93
Conversation
bf3f412
to
c13af74
Compare
Pull Request Test Coverage Report for Build 10530778457Details
💛 - Coveralls |
431c72c
to
9cbc387
Compare
9cbc387
to
ac64e04
Compare
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.
Light review ACK
A recent PR #87 exposed a |
IIUC exposes a I think it could be helpful to get exposed in async/reqwest too, I'll check it. |
Ah ok so maybe not necessary since you can already get a handle to the |
Yes, that's what I thought. |
ac64e04
to
9cb662a
Compare
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.
9cb662a
to
a61d978
Compare
1a4d5cf chore(rust+clippy): bump `edition` to 2021, and add `.clippy.toml` (Leonardo Lima) b7636e8 fix(fmt): apply suggested fixes from `rustfmt` (Leonardo Lima) 3f2ca2f refactor(ci)!: add new `fmt` and `clippy` jobs (Leonardo Lima) 9f888c1 chore(deps): bump `actions/checkout` from v3 to v4 (Leonardo Lima) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description This PR does some improvements on CI, these are some changes that I ended up doing on other refactoring and feature PRs (making them too convoluted), but had a specific CI scope so I'm moving them to a specific PR. This PR does: - bump the `actions/checkout@v3` to `actions/checkout@v4`. - adds two new jobs for `fmt` and `clippy` (clippy has been moved to a specific job). - fix the newly found `fmt` problems. - bump the rust edition to `2021`. - adds `.clippy.toml` file with `msrv=1.63.0`. <!-- Describe the purpose of this PR, what's being adding and/or fixed --> ### Notes to the reviewers I hope this PR reduces the scope convolution from the other ones #67 #93, and makes the review easier. <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ### Changelog notice - Bump the `actions/checkout@v3` to `actions/checkout@v4`. - Adds two new jobs for `fmt` and `clippy` (clippy has been moved to a specific job). - Multiple fixes for the newly found `fmt` problems. - Bump the rust edition to `2021`. - Adds `.clippy.toml` file with `msrv=1.63.0`. <!-- Notice the release manager should include in the release tag message changelog --> <!-- See https://keepachangelog.com/en/1.0.0/ for examples --> ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: ValuedMammal: ACK 1a4d5cf notmandatory: ACK 1a4d5cf Tree-SHA512: e693baeea112dffa12ccc576271f38f3188dc24669a70af7196e33e5eea08c5d82940792330682b8a4b1ec48ef98e1cbaa2f713736f393555744fdf44d79a26a
a61d978
to
a660346
Compare
I rebased this one on top of master, as #95 got merged. It should be ready to go now. |
fyi: I'm attempting to fix the code coverage CI step issue on #96. |
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.
ACK a660346
I made comments only if you plan to retouch
- apply some standard on `Cargo.toml` deps. - minor docstring improvements, and fix missing docstrings.
- remove duplicated HTTP client code for handling GET and POST requests. - adds a few new methods to `AsyncClient` implementation, the new methods are responsible to handle common HTTP requests and parsing. It was previously duplicated throughout the Esplora API implementation, but now it follows the same approach already implemented for blocking client (`BlockingClient`).
a660346
to
1103936
Compare
@oleonardolima since it seems we are planning to go down the #97 route, is this PR still relevant? |
I guess this one can still land if we'd like to cut a release with these improvements, and mainly with #98. Then, cut a new release specifically with the refactor of #97. 🤔 |
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.
ACK 1103936
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.
ACK 1103936
Overall this is a great cleanup and should be much easier to maintain.
b96270e feat(async,blocking)!: implement retryable calls (valued mammal) Pull request description: Based on #93 the PR implements retryable calls for request failure due to too many requests (429) or service unavailable (503). Inspired by #71 h/t @e1a0a0ea ### Notes I've added the field `max_retries` to the `Builder`. `max_retries` is also added to each of `AsyncClient`, `BlockingClient`. I added the dependency `async-std` in order to have async `sleep`. Instead of implementing a trait on the `Request` type as in #71, the approach is to add a method on the client that sends a get request to a url and returns the response after allowing for retries. I tested on the bdk `wallet_esplora_*` example crates against https://blockstream.info/testnet/api and it seemed to resolve the 429 issue. ACKs for top commit: oleonardolima: ACK b96270e notmandatory: tACK b96270e Tree-SHA512: 78124106959ba9a5cce58e343bbf30c29b4bc7e1ac434ba71eeb2e774d73ea003d0520139781062947ed27563748925c24998b2a5be450bc511bb2c7090a6682
Description
It builds on top of #95. Applies minor improvements on some docstrings, and Cargo.toml standard.
The main change is adding the common HTTP methods for the
AsyncClient
, it removes duplicated code from each Esplora API request, and follows the approach done forBlockingClient
.It makes it easier to extract these methods into an
AsyncEsploraClient
trait (to be done in another PR, initially done here 9cbc387), which the user can implement with any HTTP client of its choice. Also, makes it simpler to rebase and update theAsyncAnonymizedClient
from #67.Notes to the reviewers
It has some commits from #95, as it builds on top of it and should be merged afterward. Please let me know what you think about the proposed changes and approach.
Changelog notice
get_response
andpost_request
methods toAsyncClient
, previously duplicated through the esplora API calls. It follows the approach done forBlockinClient
.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing