From ee6ce05d2c0390e190d41487aed7a465a4af7de4 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 25 Sep 2024 23:43:32 +0200 Subject: [PATCH] Fixes to server --- crates/web3_account_server/Cargo.toml | 2 +- crates/web3_account_server/src/main.rs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/web3_account_server/Cargo.toml b/crates/web3_account_server/Cargo.toml index 2537f52a..a2f443f4 100644 --- a/crates/web3_account_server/Cargo.toml +++ b/crates/web3_account_server/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" name = "web3_account_server" license = "MIT" repository = "https://github.com/scx1332/" -version = "0.4.9" +version = "0.4.10" [dependencies] actix-web = { workspace = true } diff --git a/crates/web3_account_server/src/main.rs b/crates/web3_account_server/src/main.rs index d8be77e0..0f3195d4 100644 --- a/crates/web3_account_server/src/main.rs +++ b/crates/web3_account_server/src/main.rs @@ -103,11 +103,7 @@ async fn add_to_queue(data: web::Data, item: String) -> impl Responder async fn count(data: web::Data) -> impl Responder { let _lock = data.lock.lock().unwrap(); let file_name = &data.file_name; - let results: Vec = { - let file = OpenOptions::new().read(true).open(file_name).unwrap(); - let reader = BufReader::new(file); - serde_json::from_reader(reader).unwrap_or_else(|_| Vec::new()) - }; + let results = read_results(file_name); HttpResponse::Ok().body(results.len().to_string()) }