fix: no db loaded (#353)

This commit is contained in:
Lykin 2024-09-25 14:40:43 +08:00
parent a70b5b56ff
commit 026591c8d4
1 changed files with 7 additions and 8 deletions

View File

@ -166,7 +166,7 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
if totaldb <= 0 {
// cannot retrieve the database count by "CONFIG GET databases", try to get max index from keyspace
if keyspace := info["Keyspace"]; len(keyspace) > 0 {
keyspace := info["Keyspace"]
var db, maxDB int
for dbName := range keyspace {
if db, err = strconv.Atoi(strings.TrimLeft(dbName, "db")); err == nil {
@ -177,7 +177,6 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
}
totaldb = maxDB + 1
}
}
queryDB := func(idx int) types.ConnectionDB {
dbName := "db" + strconv.Itoa(idx)