Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/backends/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ impl ReleaseList {
}

fn fetch_releases(&self, url: &str) -> Result<Vec<Release>> {
let resp = http_client::get(
&format!("{url}?per_page=100"),
api_headers(&self.auth_token)?,
)?;
let request_url = if url.contains('?') {
// Pagination URL from Link header — already has query params
url.to_string()
} else {
format!("{url}?per_page=100")
};
let resp = http_client::get(&request_url, api_headers(&self.auth_token)?)?;
if !resp.status().is_success() {
bail!(
Error::Network,
Expand Down
8 changes: 7 additions & 1 deletion src/http_client/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ use super::{HeaderMap, HttpResponse};
use crate::{Error, Result};

pub fn get(url: &str, headers: HeaderMap) -> Result<impl HttpResponse> {
use std::time::Duration;

let client_builder = reqwest::blocking::ClientBuilder::new();

#[cfg(feature = "rustls")]
let client_builder = client_builder.use_rustls_tls();

let client = client_builder.http2_adaptive_window(true).build()?;
let client = client_builder
.http2_adaptive_window(true)
.connect_timeout(Duration::from_secs(30))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should IMO be consistent across reqwest and ureq.
Also don't really want to add this before this is configurable via #133, if someone relies on there not being a timeout they'll be stuck until #133 is implemented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy. I'll just submit a pagination fix PR then...

.timeout(Duration::from_secs(300))
.build()?;
let resp = client.get(url).headers(headers).send()?;

if !resp.status().is_success() {
Expand Down
Loading