Skip to content

Commit

Permalink
Make sure compilation works with each feature individually (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte authored Feb 29, 2024
1 parent 752bbb3 commit e6a477a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion omniqueue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion omniqueue/src/backends/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
8 changes: 5 additions & 3 deletions omniqueue/src/backends/rabbitmq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -137,7 +135,11 @@ impl RabbitMqProducer {
headers: Option<FieldTable>,
) -> 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());
}
Expand Down

0 comments on commit e6a477a

Please sign in to comment.