From 1a44325caeaf227c4617f8cbc045f03bd44e7e09 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Fri, 10 May 2024 17:18:59 -0400 Subject: [PATCH] Change SQS implementation to take &self immutably --- omniqueue/src/backends/sqs.rs | 4 ++-- omniqueue/tests/it/sqs.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/omniqueue/src/backends/sqs.rs b/omniqueue/src/backends/sqs.rs index e55dc55..ced81ff 100644 --- a/omniqueue/src/backends/sqs.rs +++ b/omniqueue/src/backends/sqs.rs @@ -291,7 +291,7 @@ impl SqsConsumer { } } - pub async fn receive(&mut self) -> Result { + pub async fn receive(&self) -> Result { let out = self .client .receive_message() @@ -309,7 +309,7 @@ impl SqsConsumer { } pub async fn receive_all( - &mut self, + &self, max_messages: usize, deadline: Duration, ) -> Result> { diff --git a/omniqueue/tests/it/sqs.rs b/omniqueue/tests/it/sqs.rs index 9100cd2..642f450 100644 --- a/omniqueue/tests/it/sqs.rs +++ b/omniqueue/tests/it/sqs.rs @@ -50,7 +50,7 @@ async fn make_test_queue() -> QueueBuilder { #[tokio::test] async fn test_raw_send_recv() { let payload = "{\"test\": \"data\"}"; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_raw(payload).await.unwrap(); @@ -63,7 +63,7 @@ async fn test_bytes_send_recv() { use omniqueue::QueueProducer as _; let payload = b"hello"; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_bytes(payload).await.unwrap(); @@ -80,7 +80,7 @@ pub struct ExType { #[tokio::test] async fn test_serde_send_recv() { let payload = ExType { a: 2 }; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_serde_json(&payload).await.unwrap(); @@ -94,7 +94,7 @@ async fn test_serde_send_recv() { #[tokio::test] async fn test_send_recv_all_partial() { let payload = ExType { a: 2 }; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_serde_json(&payload).await.unwrap(); let deadline = Duration::from_secs(1); @@ -114,7 +114,7 @@ async fn test_send_recv_all_partial() { async fn test_send_recv_all_full() { let payload1 = ExType { a: 1 }; let payload2 = ExType { a: 2 }; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_serde_json(&payload1).await.unwrap(); p.send_serde_json(&payload2).await.unwrap(); @@ -148,7 +148,7 @@ async fn test_send_recv_all_full_then_partial() { let payload1 = ExType { a: 1 }; let payload2 = ExType { a: 2 }; let payload3 = ExType { a: 3 }; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); p.send_serde_json(&payload1).await.unwrap(); p.send_serde_json(&payload2).await.unwrap(); @@ -189,7 +189,7 @@ async fn test_send_recv_all_full_then_partial() { /// Consumer will NOT wait indefinitely for at least one item. #[tokio::test] async fn test_send_recv_all_late_arriving_items() { - let (_p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (_p, c) = make_test_queue().await.build_pair().await.unwrap(); let deadline = Duration::from_secs(1); let now = Instant::now(); @@ -205,7 +205,7 @@ async fn test_send_recv_all_late_arriving_items() { #[tokio::test] async fn test_scheduled() { let payload1 = ExType { a: 1 }; - let (p, mut c) = make_test_queue().await.build_pair().await.unwrap(); + let (p, c) = make_test_queue().await.build_pair().await.unwrap(); let delay = Duration::from_secs(3); let now = Instant::now();