Set timeout on requests
This commit is contained in:
parent
e88efdae56
commit
f0c38b4d79
1 changed files with 2 additions and 1 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
|||
};
|
||||
use chrono::prelude::*;
|
||||
use reqwest::{Client, RedirectPolicy, Url, UrlError};
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn update_state(state: State) {
|
||||
let new_statuses = { Some(update_status(&state.read().unwrap().config)) };
|
||||
|
@ -20,7 +21,7 @@ pub fn update_status(config: &Config) -> Vec<StatusGroup> {
|
|||
for website_conf in &config.websites {
|
||||
let mut group = Vec::with_capacity(website_conf.endpoints.len());
|
||||
for endpoint in &website_conf.endpoints {
|
||||
let mut client_builder = Client::builder();
|
||||
let mut client_builder = Client::builder().timeout(Some(Duration::from_secs(5)));
|
||||
|
||||
if let Some(false) = endpoint.follow_redirects {
|
||||
client_builder = client_builder.redirect(RedirectPolicy::none());
|
||||
|
|
Loading…
Reference in a new issue