diff --git a/src/basic/keywords/add_suggestion.rs b/src/basic/keywords/add_suggestion.rs index a685e7c7..2f501ad7 100644 --- a/src/basic/keywords/add_suggestion.rs +++ b/src/basic/keywords/add_suggestion.rs @@ -1,24 +1,12 @@ use crate::core::shared::models::UserSession; use crate::core::shared::state::AppState; use log::{error, info, trace}; -use once_cell::sync::Lazy; use rhai::{Dynamic, Engine}; use serde_json::json; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; use std::time::Duration; -static REDIS_CONN: Lazy>> = Lazy::new(|| Mutex::new(None)); - fn get_redis_connection(cache_client: &Arc) -> Option { - if let Ok(mut guard) = REDIS_CONN.lock() { - if let Some(ref mut conn) = *guard { - match redis::cmd("PING").query::(conn) { - Ok(_) => return Some(conn.clone()), - Err(_) => *guard = None, - } - } - } - let timeout = Duration::from_millis(50); cache_client.get_connection_with_timeout(timeout).ok() }