You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #482: Index API client: add timeout to requests
47f5242 chore: fix comment (Jose Celano)
3d3fc2d chore: add todo to seeder (Jose Celano)
2fc2016 refactor: [#472] move unwraps from API client up (Jose Celano)
1015945 chore: remove comment (Jose Celano)
564df07 docs: move comment (Jose Celano)
a8c2f84 refactor: [#472] move unwraps from generic HTTP client up to Index API client (Jose Celano)
26422fc feat: [#472] add timeout to API client requests (Jose Celano)
9ff4de4 feat: [#472] inject URL scheme in API client (Jose Celano)
2cf5f47 refactor: [#472] move generic HTTP client (Jose Celano)
Pull request description:
The API client does not have any timeout. The client waits indefinitely for responses. That should not be the default behaviour. It should return an error after a timeout. The users using the client should handle the timeout or any other error.
### Subtasks
- [x] Move generic HTTP client to HTTP mod.
- [x] Generic HTTP client: Inject the scheme part of the URL in the constructor.
- [x] Add timeouts to the generic HTTP client.
- [x] Remove `unwraps` from the generic HTTP client. Return errors.
- [x] Remove `unwraps` from the Index API HTTP client. Return errors.
ACKs for top commit:
josecelano:
ACK 47f5242
Tree-SHA512: 59cc901b58c19aff0f5258a5297d722389beb9d1ac38838fc470e9cc3e2159abc594cb05db7c1403e2111477149c1834a68f182425cbc101bc0c29c2d0b76613
letapi_url = Url::from_str(&args.api_base_url).context("failed to parse API base URL")?;
177
179
178
-
let api_client = Client::authenticated(&args.api_base_url,&api_user.token);
180
+
let api_user = login_index_api(&api_url,&args.user,&args.password).await;
181
+
182
+
let api_client = Client::authenticated(&api_url,&api_user.token);
179
183
180
184
info!(target:"seeder","Uploading { } random torrents to the Torrust Index with a { } seconds interval...", args.number_of_torrents.to_string().yellow(), args.interval.to_string().yellow());
0 commit comments