From: Timo Tietavainen Date: Fri, 30 Sep 2022 10:22:46 +0000 (+0300) Subject: Handle CloseDB() error in statistics query X-Git-Tag: v0.10.2~2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F9148%2F1;p=ric-plt%2Fsdlgo.git Handle CloseDB() error in statistics query Add handling of Redis connection close function CloseDB() return value after sentinel statistics were queried. Issue-Id: RIC-942 Signed-off-by: Timo Tietavainen Change-Id: I632b112a085c95bf0dbe80035308ffcc799bfa10 --- diff --git a/internal/sdlgoredis/sdlgoredis.go b/internal/sdlgoredis/sdlgoredis.go index 8cdae46..7f66f0c 100644 --- a/internal/sdlgoredis/sdlgoredis.go +++ b/internal/sdlgoredis/sdlgoredis.go @@ -886,7 +886,9 @@ func sentinelStatistics(db *DB) (*DbStatistics, error) { for _, r := range dbState.ReplicasDbState.States { replicaDb := createReplicaDbClient(r.GetAddress()) dbStatisticsInfo, err = getStatisticsInfo(replicaDb, r.GetAddress()) - replicaDb.CloseDB() + if closeErr := replicaDb.CloseDB(); closeErr != nil { + return nil, closeErr + } if err != nil { return nil, err }