aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-03 22:32:23 +0100
committerGitHub <noreply@github.com>2022-11-03 22:32:23 +0100
commit142e843a5511b55d761ce10860664d709ad6d8bb (patch)
treec2e1e55a5c7b5bebb95bb9264db1f31173167d20 /src-tauri
parentd8232fa953a08aafce71e0bc9823c554eed59d7c (diff)
downloadFlightCore-142e843a5511b55d761ce10860664d709ad6d8bb.tar.gz
FlightCore-142e843a5511b55d761ce10860664d709ad6d8bb.zip
fix: Resolve thread crash due to block in async (#39)
Set the function to async but it was still using blocking version of reqwest.
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/lib.rs6
-rw-r--r--src-tauri/src/main.rs2
2 files changed, 5 insertions, 3 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 5d8d55e6..416efb64 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -358,18 +358,20 @@ pub fn convert_release_candidate_number(version_number: String) -> String {
/// Checks if installed FlightCore version is up-to-date
/// false -> FlightCore install is up-to-date
/// true -> FlightCore install is outdated
-pub fn check_is_flightcore_outdated() -> Result<bool, String> {
+pub async fn check_is_flightcore_outdated() -> Result<bool, String> {
// Get newest version number from GitHub API
println!("Checking GitHub API");
let url = "https://api.github.com/repos/GeckoEidechse/FlightCore/releases/latest";
let user_agent = "GeckoEidechse/FlightCore";
- let client = reqwest::blocking::Client::new();
+ let client = reqwest::Client::new();
let res = client
.get(url)
.header(reqwest::header::USER_AGENT, user_agent)
.send()
+ .await
.unwrap()
.text()
+ .await
.unwrap();
let json_response: serde_json::Value =
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index a0f502b6..9cc27e31 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -203,7 +203,7 @@ async fn check_is_northstar_outdated(
/// false -> FlightCore install is up-to-date
/// true -> FlightCore install is outdated
async fn check_is_flightcore_outdated_caller() -> Result<bool, String> {
- check_is_flightcore_outdated()
+ check_is_flightcore_outdated().await
}
#[tauri::command]