fix: reconnect will crash after connection fail first time (#301)

This commit is contained in:
Lykin 2024-07-11 16:03:13 +08:00
parent 9bec3934bb
commit ea8ceba32a
1 changed files with 2 additions and 0 deletions

View File

@ -325,6 +325,7 @@ func (b *browserService) getRedisClient(server string, db int) (item *connection
selConn := Connection().getConnection(server)
if selConn == nil {
err = fmt.Errorf("no match connection \"%s\"", server)
delete(b.connMap, server)
return
}
@ -337,6 +338,7 @@ func (b *browserService) getRedisClient(server string, db int) (item *connection
connConfig.LastDB = db
client, err = b.createRedisClient(ctx, connConfig)
if err != nil {
delete(b.connMap, server)
return
}
item = &connectionItem{