From 061668111a0f0a064308245bc777f7ca17bd6885 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 13 Dec 2024 20:57:21 -0500 Subject: [PATCH 1/2] Upgrade bb8 --- omniqueue/Cargo.toml | 9 ++++----- omniqueue/src/backends/redis/cluster.rs | 2 -- omniqueue/src/backends/redis/sentinel.rs | 2 -- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/omniqueue/Cargo.toml b/omniqueue/Cargo.toml index 5657b60..57011c3 100644 --- a/omniqueue/Cargo.toml +++ b/omniqueue/Cargo.toml @@ -10,13 +10,12 @@ rust-version = "1.79" edition = "2021" [dependencies] -async-trait = { version = "0.1", optional = true } aws-config = { version = "1.1.5", features = ["behavior-version-latest"], optional = true } aws-sdk-sqs = { version = "1.13.0", optional = true } azure_storage = { version = "0.21.0", optional = true } azure_storage_queues = { version = "0.21.0", optional = true } -bb8 = { version = "0.8", optional = true } -bb8-redis = { version = "0.17.0", optional = true } +bb8 = { version = "0.9.0", optional = true } +bb8-redis = { version = "0.18.0", optional = true } bytesize = "1.3.0" futures-util = { version = "0.3.28", default-features = false, features = ["async-await", "std"], optional = true } google-cloud-googleapis = { version = "0.16.0", optional = true } @@ -49,8 +48,8 @@ rabbitmq = ["dep:futures-util", "dep:lapin"] # Generate message IDs for queue items. Likely not needed outside of Svix. rabbitmq-with-message-ids = ["rabbitmq", "dep:svix-ksuid"] redis = ["dep:bb8", "dep:bb8-redis", "dep:redis", "dep:svix-ksuid"] -redis_cluster = ["dep:async-trait", "redis", "redis/cluster-async"] -redis_sentinel = ["dep:async-trait", "redis", "redis/sentinel"] +redis_cluster = ["redis", "redis/cluster-async"] +redis_sentinel = ["redis", "redis/sentinel"] sqs = ["dep:aws-config", "dep:aws-sdk-sqs"] azure_queue_storage = ["dep:azure_storage", "dep:azure_storage_queues"] beta = [] diff --git a/omniqueue/src/backends/redis/cluster.rs b/omniqueue/src/backends/redis/cluster.rs index 3d75752..7ee59be 100644 --- a/omniqueue/src/backends/redis/cluster.rs +++ b/omniqueue/src/backends/redis/cluster.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use redis::{ cluster::{ClusterClient, ClusterClientBuilder}, cluster_routing::{MultipleNodeRoutingInfo, ResponsePolicy, RoutingInfo}, @@ -22,7 +21,6 @@ impl RedisClusterConnectionManager { } } -#[async_trait] impl bb8::ManageConnection for RedisClusterConnectionManager { type Connection = redis::cluster_async::ClusterConnection; type Error = RedisError; diff --git a/omniqueue/src/backends/redis/sentinel.rs b/omniqueue/src/backends/redis/sentinel.rs index 6346ea1..2fca673 100644 --- a/omniqueue/src/backends/redis/sentinel.rs +++ b/omniqueue/src/backends/redis/sentinel.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use redis::{ sentinel::{SentinelClient, SentinelNodeConnectionInfo, SentinelServerType}, ErrorKind, IntoConnectionInfo, RedisError, @@ -33,7 +32,6 @@ impl RedisSentinelConnectionManager { } } -#[async_trait] impl bb8::ManageConnection for RedisSentinelConnectionManager { type Connection = redis::aio::MultiplexedConnection; type Error = RedisError; From 1dadae21789b21cbdee7d0e280ef557f5d91053c Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 13 Dec 2024 20:57:41 -0500 Subject: [PATCH 2/2] Fix clippy lint --- omniqueue/src/backends/redis/mod.rs | 3 +-- omniqueue/tests/it/redis_fallback.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/omniqueue/src/backends/redis/mod.rs b/omniqueue/src/backends/redis/mod.rs index 62f6480..efa1ef2 100644 --- a/omniqueue/src/backends/redis/mod.rs +++ b/omniqueue/src/backends/redis/mod.rs @@ -205,8 +205,7 @@ fn internal_to_list_payload( ) -> Vec { let id = delayed_key_id(); let num_receives = num_receives.to_string(); - let mut result = - Vec::with_capacity(id.len() + num_receives.as_bytes().len() + payload.len() + 3); + let mut result = Vec::with_capacity(id.len() + num_receives.len() + payload.len() + 3); result.extend(id.as_bytes()); result.push(b'#'); result.extend(num_receives.as_bytes()); diff --git a/omniqueue/tests/it/redis_fallback.rs b/omniqueue/tests/it/redis_fallback.rs index 627d38d..716a696 100644 --- a/omniqueue/tests/it/redis_fallback.rs +++ b/omniqueue/tests/it/redis_fallback.rs @@ -543,7 +543,7 @@ async fn test_backward_compatible() { // Old payload format: let id = svix_ksuid::Ksuid::new(None, None).to_base62(); let org_payload_str = serde_json::to_string(&org_payload).unwrap(); - let mut payload = Vec::with_capacity(id.len() + org_payload_str.as_bytes().len() + 1); + let mut payload = Vec::with_capacity(id.len() + org_payload_str.len() + 1); payload.extend(id.as_bytes()); payload.push(b'|'); payload.extend(org_payload_str.as_bytes());