From d64c510705ac1623c052aedc4ddc50aabeb1e798 Mon Sep 17 00:00:00 2001 From: Marco Tallskog Date: Wed, 11 Sep 2019 12:53:04 +0300 Subject: [PATCH] Set MaxRetries count When redis client is created, set the MaxRetries count to 2. This defines the number of times the command is tried to execute. In cases where redis server is dead but the client hasn't noticed that yet, an EOF error is returned from the first try. With the second attempt, a proper error is returned indicating that the connection was refused. Change-Id: I28ffcf83666edda9b715dafe6055cef4c633f757 Signed-off-by: Marco Tallskog --- internal/sdlgoredis/sdlgoredis.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/sdlgoredis/sdlgoredis.go b/internal/sdlgoredis/sdlgoredis.go index 0ccccb6..56ebfa8 100644 --- a/internal/sdlgoredis/sdlgoredis.go +++ b/internal/sdlgoredis/sdlgoredis.go @@ -133,6 +133,7 @@ func Create() *DB { Password: "", // no password set DB: 0, // use default DB PoolSize: 20, + MaxRetries: 2, }) db := CreateDB(client, subscribeNotifications) db.CheckCommands() -- 2.16.6