From: Marco Tallskog Date: Wed, 11 Sep 2019 09:53:04 +0000 (+0300) Subject: Set MaxRetries count X-Git-Tag: v0.3.1 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=d64c510705ac1623c052aedc4ddc50aabeb1e798;p=ric-plt%2Fsdlgo.git 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 --- 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()