diff --git a/glide-core/src/client/mod.rs b/glide-core/src/client/mod.rs index 41d09690d1..2fd0b5a494 100644 --- a/glide-core/src/client/mod.rs +++ b/glide-core/src/client/mod.rs @@ -172,12 +172,8 @@ fn get_timeout_from_cmd_arg( format!("Received timeout = {:?}.", timeout_secs), ))) } else if timeout_secs == 0.0 { - if std::str::from_utf8(&cmd.command().unwrap_or_default()) == Ok("WAIT") { - Ok(RequestTimeoutOption::ClientConfig) - } else { // `0` means we should set no timeout Ok(RequestTimeoutOption::NoTimeout) - } } else { // We limit the maximum timeout due to restrictions imposed by Redis and the Duration crate if timeout_secs > u32::MAX as f64 { diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index 349416ceee..9871fa7da4 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -8084,6 +8084,12 @@ public void wait_timeout_check(BaseClient client) { // ensure that commands doesn't time out even if timeout > request timeout assertEquals((client instanceof RedisClient ? 0 : 1), testClient.wait(1L, 1000L).get()); + + // with 0 timeout (no timeout) wait should block forever, + // but we wrap the test with timeout to avoid test failing or being stuck forever + assertThrows( + TimeoutException.class, // <- future timeout, not command timeout + () -> testClient.wait(1L, 0L).get(1, TimeUnit.SECONDS)); } } }