Use std::time::Duration

This commit is contained in:
blank X 2021-06-17 23:04:09 +07:00
parent 8732fee6c5
commit 81eb39a536
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 7 additions and 2 deletions

View File

@ -10,6 +10,7 @@ use reqwest::{
use std::env; use std::env;
use std::io::Cursor; use std::io::Cursor;
use std::iter::Skip; use std::iter::Skip;
use std::time::Duration;
extern crate serde_json; extern crate serde_json;
pub async fn run(mut args: Skip<env::Args>) { pub async fn run(mut args: Skip<env::Args>) {
@ -27,7 +28,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) .timeout(Duration::from_secs(60))
.build() .build()
.unwrap(); .unwrap();
let text = client let text = client

View File

@ -7,6 +7,7 @@ use std::borrow::Cow;
use std::env; use std::env;
use std::io::Cursor; use std::io::Cursor;
use std::iter::Skip; use std::iter::Skip;
use std::time::Duration;
extern crate serde_json; extern crate serde_json;
pub async fn run(mut args: Skip<env::Args>) { pub async fn run(mut args: Skip<env::Args>) {
@ -17,7 +18,10 @@ 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 = ClientBuilder::new().timeout(60).build().unwrap(); let client = ClientBuilder::new()
.timeout(Duration::from_secs(60))
.build()
.unwrap();
let text = client let text = client
.post("https://gitlab.com/api/graphql") .post("https://gitlab.com/api/graphql")
.body( .body(