Skip to content

Commit 5e19687

Browse files
committed
Explicit types for Redis client commands
This will break in a future Rust version due to this change: rust-lang/rust#123748
1 parent 8e18c86 commit 5e19687

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/brokers/redis.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ impl RedisBroker {
2929
impl Broker for RedisBroker {
3030
fn push_message(&self, message: &crate::messages::Message) -> Result<()> {
3131
let mut con = self.redis_client.get_connection()?;
32-
con.lpush(&self.queue, serde_json::to_string(&message)?)?;
32+
let message_as_str = serde_json::to_string(&message)?;
33+
con.lpush::<&str, String, ()>(&self.queue, message_as_str)?;
3334
Ok(())
3435
}
3536

@@ -44,7 +45,7 @@ impl Broker for RedisBroker {
4445

4546
fn store_result(&self, result_message: crate::messages::ResultMessage) -> Result<()> {
4647
let mut con = self.redis_client.get_connection()?;
47-
con.hset(
48+
con.hset::<&str, &str, String, ()>(
4849
&self.result_hash_map,
4950
&result_message.signature_id,
5051
serde_json::to_string(&result_message)?,
@@ -62,7 +63,7 @@ impl Broker for RedisBroker {
6263

6364
fn push_command(&self, command: &crate::messages::Command, worker_id: &str) -> Result<()> {
6465
let mut con = self.redis_client.get_connection()?;
65-
con.lpush(
66+
con.lpush::<&str, String, ()>(
6667
&format!("{}_{}", self.command_queue_prefix, worker_id),
6768
serde_json::to_string(&command)?,
6869
)?;
@@ -83,7 +84,7 @@ impl Broker for RedisBroker {
8384

8485
fn update_worker_info(&self, info: WorkerInfo) -> Result<()> {
8586
let mut con = self.redis_client.get_connection()?;
86-
con.hset(
87+
con.hset::<&str, &str, String, ()>(
8788
&self.worker_register,
8889
&info.id,
8990
serde_json::to_string(&info)?,

0 commit comments

Comments
 (0)