-
Notifications
You must be signed in to change notification settings - Fork 44
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
Extract Tracker API Client packages #689
Comments
josecelano
added a commit
to torrust/torrust-index
that referenced
this issue
Feb 12, 2024
3f629c2 refactor: [#473] tracker API client. Remove duplicate code (Jose Celano) 7256b46 feat: [#473] add timeout to Tracker API Client requests (Jose Celano) Pull request description: Ass default timeout of 5 seconds for Tracker API requests. In the future, we could use the official Tracker API client. See torrust/torrust-tracker#689. However, it's also fine to use this reduced client. Because we do not need all the PAI endpoints. ACKs for top commit: josecelano: ACK 3f629c2 Tree-SHA512: fc22ceac6ef234fb1bd20b6ae5099cea17ddfe2cb599faa3ad6f3e2ae04d93043e6af0b9a85dc41785f0a99bf7ace13f8e5e0cb656058390bf20585b236bf5e6
The current implementation in the Index with some improvements like a timeout for requests:
|
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Feb 28, 2025
- Add a timeout to the requests. - Return an error in the construction if it can't build the HTTP client. - Extract constants.
josecelano
added a commit
that referenced
this issue
Feb 28, 2025
89b0bfd refactor: [#689] improve REST API client (Jose Celano) Pull request description: Refactor: improve REST API client: - Add a timeout to the requests. - Return an error in the constructor if it can't build the HTTP client. - Extract constants. ACKs for top commit: josecelano: ACK 89b0bfd Tree-SHA512: 2b552e2ed6ce56587f5a364ed1b3fcc4b20d16f2ea5229e33594f2f35c5c25835ae84f8864a1d1114e906fc9af2b4a6f82d287c30d4798795b2a590d13909046
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Relates to: torrust/torrust-index#806
Relates to: #255 (comment)
We are using a Tracker API Client in test code.
See: https://github.com/torrust/torrust-tracker/blob/develop/tests/servers/api/v1/client.rs
That client is duplicated in the Index because the Index calls the Tracker API:
https://github.com/torrust/torrust-index/blob/develop/src/tracker/api.rs
We should extract that login into an independent package so that the Index can use it and we remove that duplicate code.
Before extracting the package we should clean it and make it ready for production. Currently, is not ready because
http://
.request
errors or we wrap them.I propose to create this packages:
packages/api-types
(torrust-tracker-api-types
)packages/api-client
(torrust-tracker-api-client
) <- depends ontorrust-tracker-api-types
packages/api-server
(torrust-tracker-api-server
) <- depends ontorrust-tracker-api-types
. Maybe in the futureIMPORTANT: the implementation in the Index was improved. We have to apply those improvements to this client.
The text was updated successfully, but these errors were encountered: