From 5dc49ccef08a86430a597ec63cf79f8322dab6d1 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 5 Nov 2022 17:40:52 +0100 Subject: Indexer: Hold indexer lock for less time when in search endpoint --- indexer/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indexer') diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 7d5a1af..8d738cd 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -161,8 +161,6 @@ async fn search( data: web::Data, path: web::Path, ) -> impl Responder { - let indexer = data.indexer.lock().unwrap(); - let query = match &path.query { Some(query) => query, None => return "[]".to_string(), @@ -170,8 +168,8 @@ async fn search( println!("Query: {:?}", query); - let results = indexer.search(query); - //+is lowercase search good (we turn ascii lowercase, what do we do with inserting) + let results = data.indexer.lock().unwrap().search(query); + //indexer is slow (gets stuck when inserting stuff) serde_json::to_string(&results.unwrap()).unwrap() } -- cgit 1.4.1