Skip to content

Commit a5fd8b6

Browse files
authored
Add timeout when checking for updates (#206)
1 parent 97e89c6 commit a5fd8b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/src/utils.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub mod uuid {
137137

138138
pub mod update {
139139
use crate::banner::version::current;
140-
use std::path::Path;
140+
use std::{path::Path, time::Duration};
141141

142142
use anyhow::anyhow;
143143
use chrono::{DateTime, Utc};
@@ -168,7 +168,10 @@ pub mod update {
168168
}
169169

170170
pub fn get_latest() -> Result<LatestRelease, anyhow::Error> {
171-
let agent = ureq::builder().user_agent(user_agent().as_str()).build();
171+
let agent = ureq::builder()
172+
.user_agent(user_agent().as_str())
173+
.timeout(Duration::from_secs(8))
174+
.build();
172175

173176
let json: serde_json::Value = agent
174177
.get("https://download.parseable.io/latest-version")

0 commit comments

Comments
 (0)