Add timeout of 60 seconds

This commit is contained in:
blank X 2021-06-17 22:59:00 +07:00
parent 550a8b05c4
commit 8732fee6c5
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 3 additions and 2 deletions

View File

@ -27,6 +27,7 @@ pub async fn run(mut args: Skip<env::Args>) {
env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION") env!("CARGO_PKG_VERSION")
)) ))
.timeout(60)
.build() .build()
.unwrap(); .unwrap();
let text = client let text = client

View File

@ -2,7 +2,7 @@ mod structs;
use quick_xml::events::{BytesEnd, BytesStart, BytesText, Event}; use quick_xml::events::{BytesEnd, BytesStart, BytesText, Event};
use quick_xml::{Reader, Writer}; use quick_xml::{Reader, Writer};
use reqwest::{Client, Url}; use reqwest::{ClientBuilder, Url};
use std::borrow::Cow; use std::borrow::Cow;
use std::env; use std::env;
use std::io::Cursor; use std::io::Cursor;
@ -17,7 +17,7 @@ pub async fn run(mut args: Skip<env::Args>) {
"mr" => structs::MR_QUERY, "mr" => structs::MR_QUERY,
_ => panic!("Unknown type"), _ => panic!("Unknown type"),
}; };
let client = Client::new(); let client = ClientBuilder::new().timeout(60).build().unwrap();
let text = client let text = client
.post("https://gitlab.com/api/graphql") .post("https://gitlab.com/api/graphql")
.body( .body(