fix: reconnect will crash after connection fail first time (#301)
This commit is contained in:
parent
9bec3934bb
commit
ea8ceba32a
|
@ -325,6 +325,7 @@ func (b *browserService) getRedisClient(server string, db int) (item *connection
|
||||||
selConn := Connection().getConnection(server)
|
selConn := Connection().getConnection(server)
|
||||||
if selConn == nil {
|
if selConn == nil {
|
||||||
err = fmt.Errorf("no match connection \"%s\"", server)
|
err = fmt.Errorf("no match connection \"%s\"", server)
|
||||||
|
delete(b.connMap, server)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,6 +338,7 @@ func (b *browserService) getRedisClient(server string, db int) (item *connection
|
||||||
connConfig.LastDB = db
|
connConfig.LastDB = db
|
||||||
client, err = b.createRedisClient(ctx, connConfig)
|
client, err = b.createRedisClient(ctx, connConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
delete(b.connMap, server)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
item = &connectionItem{
|
item = &connectionItem{
|
||||||
|
|
Loading…
Reference in New Issue