Skip to content

Commit

Permalink
feat: add disable client setinfo feature and its default mode is off (r…
Browse files Browse the repository at this point in the history
…edis-rs#1036)

* feat: add disable client setinfo feature and its default mode is off

* fix: add condition compile switch at the defination of setinfo function

* fix: remove format code
  • Loading branch information
Ggiggle authored Jan 24, 2024
1 parent fd54dd0 commit 3fec142
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions redis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ rust_decimal = ["dep:rust_decimal"]
bigdecimal = ["dep:bigdecimal"]
num-bigint = ["dep:num-bigint"]
uuid = ["dep:uuid"]
disable-client-setinfo = []

# Deprecated features
tls = ["tls-native-tls"] # use "tls-native-tls" instead
Expand Down
1 change: 1 addition & 0 deletions redis/src/aio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ where

// result is ignored, as per the command's instructions.
// https://redis.io/commands/client-setinfo/
#[cfg(not(feature = "disable-client-setinfo"))]
let _: RedisResult<()> = crate::connection::client_set_info_pipeline()
.query_async(con)
.await;
Expand Down
2 changes: 2 additions & 0 deletions redis/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ pub fn connect(
setup_connection(con, &connection_info.redis)
}

#[cfg(not(feature = "disable-client-setinfo"))]
pub(crate) fn client_set_info_pipeline() -> Pipeline {
let mut pipeline = crate::pipe();
pipeline
Expand Down Expand Up @@ -977,6 +978,7 @@ fn setup_connection(

// result is ignored, as per the command's instructions.
// https://redis.io/commands/client-setinfo/
#[cfg(not(feature = "disable-client-setinfo"))]
let _: RedisResult<()> = client_set_info_pipeline().query(&mut rv);

Ok(rv)
Expand Down

0 comments on commit 3fec142

Please sign in to comment.