diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 52be54f..d875eda 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,10 +24,12 @@ jobs: toolchain: ${{ matrix.rust }} components: clippy, rustfmt + - uses: taiki-e/install-action@cargo-hack + - uses: Swatinem/rust-cache@v1 - name: Clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo hack --each-feature clippy --all-targets -- -D warnings - name: rustfmt run: cargo fmt -- --check diff --git a/omniqueue/Cargo.toml b/omniqueue/Cargo.toml index 67cdf88..0cbae5e 100644 --- a/omniqueue/Cargo.toml +++ b/omniqueue/Cargo.toml @@ -42,7 +42,7 @@ in_memory = [] gcp_pubsub = ["dep:futures-util", "dep:google-cloud-googleapis", "dep:google-cloud-pubsub"] rabbitmq = ["dep:futures-util", "dep:lapin"] # Generate message IDs for queue items. Likely not needed outside of Svix. -rabbitmq-with-message-ids = ["rabbitmq", "dep:time"] +rabbitmq-with-message-ids = ["rabbitmq", "dep:time", "dep:svix-ksuid"] redis = ["dep:bb8", "dep:bb8-redis", "dep:redis", "dep:svix-ksuid"] redis_cluster = ["redis", "redis/cluster-async"] sqs = ["dep:aws-config", "dep:aws-sdk-sqs"] diff --git a/omniqueue/src/backends/mod.rs b/omniqueue/src/backends/mod.rs index a6e81be..3fd3ab4 100644 --- a/omniqueue/src/backends/mod.rs +++ b/omniqueue/src/backends/mod.rs @@ -15,7 +15,9 @@ pub use gcp_pubsub::{GcpPubSubBackend, GcpPubSubConfig, GcpPubSubConsumer, GcpPu pub use in_memory::{InMemoryBackend, InMemoryConsumer, InMemoryProducer}; #[cfg(feature = "rabbitmq")] pub use rabbitmq::{RabbitMqBackend, RabbitMqConfig, RabbitMqConsumer, RabbitMqProducer}; +#[cfg(feature = "redis_cluster")] +pub use redis::RedisClusterBackend; #[cfg(feature = "redis")] -pub use redis::{RedisBackend, RedisClusterBackend, RedisConfig, RedisConsumer, RedisProducer}; +pub use redis::{RedisBackend, RedisConfig, RedisConsumer, RedisProducer}; #[cfg(feature = "sqs")] pub use sqs::{SqsBackend, SqsConfig, SqsConsumer, SqsProducer}; diff --git a/omniqueue/src/backends/rabbitmq.rs b/omniqueue/src/backends/rabbitmq.rs index 308036f..3f0653a 100644 --- a/omniqueue/src/backends/rabbitmq.rs +++ b/omniqueue/src/backends/rabbitmq.rs @@ -13,8 +13,6 @@ pub use lapin::{ BasicProperties, Channel, Connection, ConnectionProperties, Consumer, }; use serde::Serialize; -use svix_ksuid::{KsuidLike as _, KsuidMs}; -use time::OffsetDateTime; use crate::{ builder::{QueueBuilder, Static}, @@ -137,7 +135,11 @@ impl RabbitMqProducer { headers: Option, ) -> Result<()> { let mut properties = self.properties.clone(); - if cfg!(feature = "rabbitmq-with-message-ids") { + #[cfg(feature = "rabbitmq-with-message-ids")] + { + use svix_ksuid::{KsuidLike as _, KsuidMs}; + use time::OffsetDateTime; + let id = &KsuidMs::new(Some(OffsetDateTime::now_utc()), None); properties = properties.with_message_id(id.to_string().into()); }