fix: cannot get count of databases with CONFIG GET command #5 #13

This commit is contained in:
tiny-craft 2023-09-26 00:57:20 +08:00
parent e584d7f078
commit 47e9d908e7
1 changed files with 5 additions and 8 deletions

View File

@ -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