From 47e9d908e7eb34b29d68381ba8452b7e67a3b7de Mon Sep 17 00:00:00 2001 From: tiny-craft <137850705+tiny-craft@users.noreply.github.com> Date: Tue, 26 Sep 2023 00:57:20 +0800 Subject: [PATCH] fix: cannot get count of databases with CONFIG GET command #5 #13 --- backend/services/connection_service.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go index 0737bbe..4cf7845 100644 --- a/backend/services/connection_service.go +++ b/backend/services/connection_service.go @@ -183,14 +183,11 @@ func (c *connectionService) OpenConnection(name string) (resp types.JSResp) { } // get total databases - config, err := rdb.ConfigGet(ctx, "databases").Result() - if err != nil { - resp.Msg = err.Error() - return - } - totaldb, err := strconv.Atoi(config["database"]) - if err != nil { - totaldb = 16 + totaldb := 16 + if config, err := rdb.ConfigGet(ctx, "databases").Result(); err == nil { + if total, err := strconv.Atoi(config["databases"]); err == nil { + totaldb = total + } } // get database info