Skip to content

Commit

Permalink
✨Supported specifying REDIS_RETRIES
Browse files Browse the repository at this point in the history
  • Loading branch information
carefree0910 committed Oct 24, 2024
1 parent b6919a8 commit 4dded88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cfpyo3_rs_core/src/io/temporal/mem/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ fn init_client(urls: Vec<String>) -> Result<Mutex<ClusterClient>> {
.parse::<u64>()
.expect("failed to parse REDIS_CONNECTION_TIMEOUT from env");
let connection_timeout = std::time::Duration::from_secs(connection_timeout);
let retries = env::var("REDIS_RETRIES")
.unwrap_or("3".to_string())
.parse::<u32>()
.expect("failed to parse REDIS_RETRIES from env");
let client = ClusterClientBuilder::new(urls.clone())
.username(username)
.password(password)
.connection_timeout(connection_timeout)
.response_timeout(connection_timeout)
.retries(retries)
.build()?;
Ok(Mutex::new(client))
}
Expand Down

0 comments on commit 4dded88

Please sign in to comment.