Set MaxRetries count 35/935/2 v0.3.1
authorMarco Tallskog <marco.tallskog@nokia.com>
Wed, 11 Sep 2019 09:53:04 +0000 (12:53 +0300)
committerMarco Tallskog <marco.tallskog@nokia.com>
Wed, 11 Sep 2019 10:06:21 +0000 (13:06 +0300)
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 <marco.tallskog@nokia.com>
internal/sdlgoredis/sdlgoredis.go

index 0ccccb6..56ebfa8 100644 (file)
@@ -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()