From 81eb39a536ab7fe5cd45e10ac4630385d5d54216 Mon Sep 17 00:00:00 2001 From: blank X Date: Thu, 17 Jun 2021 23:04:09 +0700 Subject: [PATCH] Use std::time::Duration --- src/github/mod.rs | 3 ++- src/gitlab/mod.rs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/github/mod.rs b/src/github/mod.rs index 6b425bc..1b819a0 100644 --- a/src/github/mod.rs +++ b/src/github/mod.rs @@ -10,6 +10,7 @@ use reqwest::{ use std::env; use std::io::Cursor; use std::iter::Skip; +use std::time::Duration; extern crate serde_json; pub async fn run(mut args: Skip) { @@ -27,7 +28,7 @@ pub async fn run(mut args: Skip) { env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION") )) - .timeout(60) + .timeout(Duration::from_secs(60)) .build() .unwrap(); let text = client diff --git a/src/gitlab/mod.rs b/src/gitlab/mod.rs index 7aeb350..da97e30 100644 --- a/src/gitlab/mod.rs +++ b/src/gitlab/mod.rs @@ -7,6 +7,7 @@ use std::borrow::Cow; use std::env; use std::io::Cursor; use std::iter::Skip; +use std::time::Duration; extern crate serde_json; pub async fn run(mut args: Skip) { @@ -17,7 +18,10 @@ pub async fn run(mut args: Skip) { "mr" => structs::MR_QUERY, _ => 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 .post("https://gitlab.com/api/graphql") .body(