use 5s timeout for get request
This commit is contained in:
parent
60434be505
commit
0aca77375f
|
@ -45,6 +45,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let mut write_queries: Vec<WriteQuery> = Vec::new();
|
||||
|
||||
let http_client = reqwest::Client::builder()
|
||||
.timeout(core::time::Duration::from_secs(5))
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
if let Some(configs) = config_data["configs"].as_array() {
|
||||
for config in configs {
|
||||
let mut handlebars = Handlebars::new();
|
||||
|
@ -54,7 +59,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let url = handlebars.render("url", &data).unwrap();
|
||||
println!("URL: {}", url);
|
||||
|
||||
let response_json: serde_json::Value = reqwest::get(url)
|
||||
let response_json: serde_json::Value = http_client
|
||||
.get(url)
|
||||
.send()
|
||||
.await?
|
||||
.json()
|
||||
.await?;
|
||||
|
|
Loading…
Reference in New Issue