diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 8018bed..433209c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -127,7 +127,13 @@ async fn fetch_prusa( } async fn poll_prusa(name: String, host: String, api_key: String, state: StateMap) { - let client = Client::new(); + let client = Client::builder() + .timeout(Duration::from_secs(10)) + .build() + .unwrap_or_else(|e| { + error!(name, error = %e, "Failed to build HTTP client"); + process::exit(1); + }); loop { if let Err(e) = fetch_prusa(&client, &name, &host, &api_key, &state).await { error!(name, error = %e, "Error polling Prusa printer"); |
