diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go index 1b3dba3..5f7732d 100644 --- a/backend/services/connection_service.go +++ b/backend/services/connection_service.go @@ -144,9 +144,6 @@ func (c *connectionService) buildOption(config types.ConnectionConfig) (*redis.O option.Addr = fmt.Sprintf("%s:%d", config.Addr, config.Port) } } - if config.LastDB > 0 { - option.DB = config.LastDB - } if sshClient != nil { option.Dialer = func(ctx context.Context, network, addr string) (net.Conn, error) { return sshClient.Dial(network, addr) @@ -181,6 +178,10 @@ func (c *connectionService) createRedisClient(config types.ConnectionConfig) (re option.Password = config.Sentinel.Password } + if config.LastDB > 0 { + option.DB = config.LastDB + } + rdb := redis.NewClient(option) if config.Cluster.Enable { // connect to cluster