Skip to content

Commit

Permalink
feat: add timeout to reqwest for retry
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Apr 6, 2024
1 parent 102688e commit 2a54ea0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion worker/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ async fn build_worker_inner(args: &Args) -> anyhow::Result<()> {

info!("Receiving new messages");

let client = reqwest::Client::new();
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(30))
.build()
.unwrap();
let req = WorkerPollRequest {
hostname: gethostname::gethostname().to_string_lossy().to_string(),
arch: args.arch.clone(),
Expand Down
5 changes: 4 additions & 1 deletion worker/src/heartbeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use log::{info, warn};
use std::time::Duration;

pub async fn heartbeat_worker_inner(args: &Args) -> anyhow::Result<()> {
let client = reqwest::Client::new();
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(30))
.build()
.unwrap();
loop {
// info!("Sending heartbeat");
client
Expand Down

0 comments on commit 2a54ea0

Please sign in to comment.