From 00d7aaa66cc5bc9d3c2ae6b918ea4cab79b6b7c4 Mon Sep 17 00:00:00 2001 From: skeptrune Date: Fri, 6 Sep 2024 00:31:09 -0700 Subject: [PATCH] cleanup: properly handle fallback types for redis for Rust '24 version --- server/src/bin/bktree-worker.rs | 2 +- server/src/bin/delete-worker.rs | 4 ++-- server/src/bin/file-worker.rs | 6 +++--- server/src/bin/grupdate-worker.rs | 4 ++-- server/src/bin/ingestion-worker.rs | 2 +- server/src/bin/queue-bm25-migration.rs | 2 +- server/src/bin/word-worker.rs | 4 ++-- server/src/handlers/auth_handler.rs | 2 +- server/src/handlers/chunk_handler.rs | 4 ++-- server/src/handlers/file_handler.rs | 2 +- server/src/middleware/auth_middleware.rs | 2 +- server/src/operators/dataset_operator.rs | 4 ++-- server/src/operators/file_operator.rs | 2 +- server/src/operators/group_operator.rs | 2 +- server/src/operators/model_operator.rs | 4 ++-- server/src/operators/organization_operator.rs | 6 +++--- server/src/operators/typo_operator.rs | 2 +- server/src/operators/user_operator.rs | 20 ++++++++++++------- 18 files changed, 40 insertions(+), 34 deletions(-) diff --git a/server/src/bin/bktree-worker.rs b/server/src/bin/bktree-worker.rs index 06144ee914..0a029bb719 100644 --- a/server/src/bin/bktree-worker.rs +++ b/server/src/bin/bktree-worker.rs @@ -351,7 +351,7 @@ pub async fn readd_error_to_queue( redis::cmd("SADD") .arg("bktree_dead_letters") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/bin/delete-worker.rs b/server/src/bin/delete-worker.rs index a9af026003..ea6368618d 100644 --- a/server/src/bin/delete-worker.rs +++ b/server/src/bin/delete-worker.rs @@ -416,7 +416,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("dead_letters_delete") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; @@ -456,7 +456,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("delete_dataset_queue") .arg(&new_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/bin/file-worker.rs b/server/src/bin/file-worker.rs index 20274e633c..3a669d0ed3 100644 --- a/server/src/bin/file-worker.rs +++ b/server/src/bin/file-worker.rs @@ -311,7 +311,7 @@ async fn upload_file( let tika_html_parse_span = transaction.start_child("tika_html_parse", "Parse tika html"); let tika_response = tika_client - .put(&format!("{}/tika", tika_url)) + .put(format!("{}/tika", tika_url)) .header("Accept", "text/html") .body(file_data.clone()) .send() @@ -434,7 +434,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("dead_letters_file") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; @@ -462,7 +462,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("file_ingestion") .arg(&new_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/bin/grupdate-worker.rs b/server/src/bin/grupdate-worker.rs index 4bd4ff8c2b..58b89819ef 100644 --- a/server/src/bin/grupdate-worker.rs +++ b/server/src/bin/grupdate-worker.rs @@ -341,7 +341,7 @@ pub async fn readd_group_error_to_queue( redis::cmd("lpush") .arg("dead_letters_group") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; @@ -369,7 +369,7 @@ pub async fn readd_group_error_to_queue( redis::cmd("lpush") .arg("group_update_queue") .arg(&new_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/bin/ingestion-worker.rs b/server/src/bin/ingestion-worker.rs index bdaa40f31b..95fd3a799d 100644 --- a/server/src/bin/ingestion-worker.rs +++ b/server/src/bin/ingestion-worker.rs @@ -1269,7 +1269,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("dead_letters") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/bin/queue-bm25-migration.rs b/server/src/bin/queue-bm25-migration.rs index 4fb06698ab..55ad1363f4 100644 --- a/server/src/bin/queue-bm25-migration.rs +++ b/server/src/bin/queue-bm25-migration.rs @@ -81,7 +81,7 @@ async fn main() -> Result<(), ServiceError> { redis::cmd("lpush") .arg("collection_migration") .arg(&message) - .query_async(&mut *conn) + .query_async::(&mut *conn) .await .map_err(|_| { ServiceError::BadRequest("Failed to send message to redis".to_string()) diff --git a/server/src/bin/word-worker.rs b/server/src/bin/word-worker.rs index a3af6efb1b..8c5b75eab9 100644 --- a/server/src/bin/word-worker.rs +++ b/server/src/bin/word-worker.rs @@ -393,7 +393,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("dictionary_dead_letters") .arg(old_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; return Err(ServiceError::InternalServerError(format!( @@ -409,7 +409,7 @@ pub async fn readd_error_to_queue( redis::cmd("lpush") .arg("create_dictionary") .arg(&new_payload_message) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/handlers/auth_handler.rs b/server/src/handlers/auth_handler.rs index 28db339d5a..95690aac28 100644 --- a/server/src/handlers/auth_handler.rs +++ b/server/src/handlers/auth_handler.rs @@ -529,7 +529,7 @@ pub async fn callback( })?; redis_conn - .set(slim_user.id.to_string(), slim_user_string) + .set::<_, _, ()>(slim_user.id.to_string(), slim_user_string) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/handlers/chunk_handler.rs b/server/src/handlers/chunk_handler.rs index a34290895c..85fb1e6442 100644 --- a/server/src/handlers/chunk_handler.rs +++ b/server/src/handlers/chunk_handler.rs @@ -723,7 +723,7 @@ pub async fn update_chunk( redis::cmd("lpush") .arg("ingestion") .arg(serde_json::to_string(&message)?) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; @@ -869,7 +869,7 @@ pub async fn update_chunk_by_tracking_id( redis::cmd("lpush") .arg("ingestion") .arg(serde_json::to_string(&message)?) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/handlers/file_handler.rs b/server/src/handlers/file_handler.rs index f9828ba73d..60a59c70e7 100644 --- a/server/src/handlers/file_handler.rs +++ b/server/src/handlers/file_handler.rs @@ -194,7 +194,7 @@ pub async fn upload_file_handler( redis::cmd("lpush") .arg("file_ingestion") .arg(&serialized_message) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; push_to_redis_span.finish(); diff --git a/server/src/middleware/auth_middleware.rs b/server/src/middleware/auth_middleware.rs index f07f811599..c8cca9a9c1 100644 --- a/server/src/middleware/auth_middleware.rs +++ b/server/src/middleware/auth_middleware.rs @@ -228,7 +228,7 @@ async fn get_user( let slim_user_string = serde_json::to_string(&slim_user).ok()?; redis_conn - .set(slim_user.id.to_string(), slim_user_string) + .set::<_, _, ()>(slim_user.id.to_string(), slim_user_string) .await .ok()?; diff --git a/server/src/operators/dataset_operator.rs b/server/src/operators/dataset_operator.rs index 140156f2f7..b09ba3b9b7 100644 --- a/server/src/operators/dataset_operator.rs +++ b/server/src/operators/dataset_operator.rs @@ -262,7 +262,7 @@ pub async fn soft_delete_dataset_by_id_query( redis::cmd("lpush") .arg("delete_dataset_queue") .arg(&serialized_message) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; @@ -297,7 +297,7 @@ pub async fn clear_dataset_by_dataset_id_query( redis::cmd("lpush") .arg("delete_dataset_queue") .arg(&serialized_message) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/operators/file_operator.rs b/server/src/operators/file_operator.rs index 14076be369..5b51659a0d 100644 --- a/server/src/operators/file_operator.rs +++ b/server/src/operators/file_operator.rs @@ -255,7 +255,7 @@ pub async fn create_file_chunks( redis::cmd("lpush") .arg("ingestion") .arg(&serialized_message) - .query_async(&mut redis_conn) + .query_async::(&mut redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; } diff --git a/server/src/operators/group_operator.rs b/server/src/operators/group_operator.rs index ba08301397..595ec424a2 100644 --- a/server/src/operators/group_operator.rs +++ b/server/src/operators/group_operator.rs @@ -770,7 +770,7 @@ pub async fn soft_update_grouped_chunks_query( redis::cmd("lpush") .arg("group_update_queue") .arg(&serialized_message) - .query_async(&mut *redis_conn) + .query_async::<_, ()>(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/operators/model_operator.rs b/server/src/operators/model_operator.rs index 8abc04129f..c31ac3597c 100644 --- a/server/src/operators/model_operator.rs +++ b/server/src/operators/model_operator.rs @@ -427,7 +427,7 @@ pub async fn get_dense_vectors( let vectors_resp = async move { let embeddings_resp = cur_client - .post(&format!("{}/embeddings?api-version=2023-05-15", url)) + .post(format!("{}/embeddings?api-version=2023-05-15", url)) .header("Authorization", &format!("Bearer {}", &embedding_api_key.clone())) .header("api-key", &embedding_api_key.clone()) .header("Content-Type", "application/json") @@ -511,7 +511,7 @@ pub async fn get_dense_vectors( let vectors_resp = async move { let embeddings_resp = cur_client - .post(&format!("{}/embeddings?api-version=2023-05-15", url)) + .post(format!("{}/embeddings?api-version=2023-05-15", url)) .header("Authorization", &format!("Bearer {}", &embedding_api_key.clone())) .header("api-key", &embedding_api_key.clone()) .header("Content-Type", "application/json") diff --git a/server/src/operators/organization_operator.rs b/server/src/operators/organization_operator.rs index 987ab0eef4..45f6f1ceea 100644 --- a/server/src/operators/organization_operator.rs +++ b/server/src/operators/organization_operator.rs @@ -104,7 +104,7 @@ pub async fn update_organization_query( ServiceError::InternalServerError("Failed to get redis connection".to_string()) })?; - redis_conn.del(users).await.map_err(|_| { + redis_conn.del::<_, ()>(users).await.map_err(|_| { ServiceError::InternalServerError("Failed to delete user from redis".to_string()) })?; @@ -145,7 +145,7 @@ pub async fn delete_organization_query( ServiceError::InternalServerError("Failed to get redis connection".to_string()) })?; - redis_conn.del(users).await.map_err(|_| { + redis_conn.del::<_, ()>(users).await.map_err(|_| { ServiceError::InternalServerError("Failed to delete user from redis".to_string()) })?; @@ -225,7 +225,7 @@ pub async fn delete_organization_query( })?; redis_conn - .sadd("deleted_organizations", org_id.to_string()) + .sadd::<_, _, ()>("deleted_organizations", org_id.to_string()) .await .map_err(|_| { ServiceError::InternalServerError( diff --git a/server/src/operators/typo_operator.rs b/server/src/operators/typo_operator.rs index 87c757a344..ca8fd6e2dc 100644 --- a/server/src/operators/typo_operator.rs +++ b/server/src/operators/typo_operator.rs @@ -360,7 +360,7 @@ impl BkTree { redis::cmd("SET") .arg(format!("bk_tree_{}", dataset_id)) .arg(serialized_bk_tree) - .query_async(&mut *redis_conn) + .query_async::(&mut *redis_conn) .await .map_err(|err| ServiceError::BadRequest(err.to_string()))?; diff --git a/server/src/operators/user_operator.rs b/server/src/operators/user_operator.rs index 2399a80c59..aaeea94bfb 100644 --- a/server/src/operators/user_operator.rs +++ b/server/src/operators/user_operator.rs @@ -146,9 +146,12 @@ pub async fn update_user_org_role_query( ServiceError::InternalServerError("Failed to get redis connection".to_string()) })?; - redis_conn.del(user_id.to_string()).await.map_err(|_| { - ServiceError::InternalServerError("Failed to delete user from redis".to_string()) - })?; + redis_conn + .del::<_, ()>(user_id.to_string()) + .await + .map_err(|_| { + ServiceError::InternalServerError("Failed to delete user from redis".to_string()) + })?; Ok(()) } @@ -486,7 +489,7 @@ pub async fn add_user_to_organization( })?; redis_conn - .del(user_id_refresh.to_string()) + .del::<_, ()>(user_id_refresh.to_string()) .await .map_err(|_| { ServiceError::InternalServerError("Failed to delete user from redis".to_string()) @@ -611,9 +614,12 @@ pub async fn remove_user_from_org_query( ServiceError::InternalServerError("Failed to get redis connection".to_string()) })?; - redis_conn.del(user_id.to_string()).await.map_err(|_| { - ServiceError::InternalServerError("Failed to delete user from redis".to_string()) - })?; + redis_conn + .del::<_, ()>(user_id.to_string()) + .await + .map_err(|_| { + ServiceError::InternalServerError("Failed to delete user from redis".to_string()) + })?; Ok(()) }