This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new d3115ba5 fix: Add timeouts to go-redis client and ping on client 
creation (#2404)
d3115ba5 is described below

commit d3115ba5fc6de39dd9cdf2bc74ef29f1d44e0914
Author: Yaroslav <[email protected]>
AuthorDate: Sun Jul 14 00:54:58 2024 +0300

    fix: Add timeouts to go-redis client and ping on client creation (#2404)
---
 tests/gocase/util/server.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/gocase/util/server.go b/tests/gocase/util/server.go
index 849b47ad..88a6211b 100644
--- a/tests/gocase/util/server.go
+++ b/tests/gocase/util/server.go
@@ -83,11 +83,19 @@ func (s *KvrocksServer) NewClient() *redis.Client {
        return s.NewClientWithOption(&redis.Options{})
 }
 
+func optionsWithTimeouts(options *redis.Options) *redis.Options {
+       options.DialTimeout = 30 * time.Second
+       options.ReadTimeout = 30 * time.Second
+       options.WriteTimeout = 30 * time.Second
+       return options
+}
+
 func (s *KvrocksServer) NewClientWithOption(options *redis.Options) 
*redis.Client {
        if options.Addr == "" {
                options.Addr = s.addr.String()
        }
-       return redis.NewClient(options)
+
+       return redis.NewClient(optionsWithTimeouts(options))
 }
 
 func (s *KvrocksServer) NewTCPClient() *TCPClient {

Reply via email to