mirror of
https://github.com/qishibo/AnotherRedisDesktopManager.git
synced 2026-01-25 16:46:32 +00:00
fix #735 ssh-sentinel connection bug
This commit is contained in:
parent
6e5073ba10
commit
fa00487a47
@ -138,18 +138,20 @@ export default {
|
||||
}, this.pingInterval);
|
||||
},
|
||||
getRedisClient(config) {
|
||||
// prevent changing back to raw config, such as config.db
|
||||
const configCopy = JSON.parse(JSON.stringify(config));
|
||||
// select db
|
||||
config.db = this.lastSelectedDb;
|
||||
configCopy.db = this.lastSelectedDb;
|
||||
|
||||
// ssh client
|
||||
if (config.sshOptions) {
|
||||
if (configCopy.sshOptions) {
|
||||
var clientPromise = redisClient.createSSHConnection(
|
||||
config.sshOptions, config.host, config.port, config.auth, config);
|
||||
configCopy.sshOptions, configCopy.host, configCopy.port, configCopy.auth, configCopy);
|
||||
}
|
||||
// normal client
|
||||
else {
|
||||
var clientPromise = redisClient.createConnection(
|
||||
config.host, config.port, config.auth, config);
|
||||
configCopy.host, configCopy.port, configCopy.auth, configCopy);
|
||||
}
|
||||
|
||||
clientPromise.then((client) => {
|
||||
|
||||
@ -43,6 +43,8 @@ export default {
|
||||
|
||||
for (const item of connections) {
|
||||
item.connectionName = storage.getConnectionName(item);
|
||||
// fix history bug, prevent db into config
|
||||
delete item.db;
|
||||
slovedConnections.push(item);
|
||||
}
|
||||
|
||||
|
||||
@ -30,10 +30,14 @@ Redis.Command.setReplyTransformer("hgetall", (result) => {
|
||||
|
||||
|
||||
export default {
|
||||
createConnection(host, port, auth, config, promise = true, forceStandalone = false) {
|
||||
createConnection(host, port, auth, config, promise = true, forceStandalone = false, removeDb = false) {
|
||||
let options = this.getRedisOptions(host, port, auth, config);
|
||||
let client = null;
|
||||
|
||||
if (removeDb) {
|
||||
delete options.db;
|
||||
}
|
||||
|
||||
if (forceStandalone) {
|
||||
client = new Redis(options);
|
||||
}
|
||||
@ -100,7 +104,8 @@ export default {
|
||||
|
||||
// sentinel mode
|
||||
if (configRaw.sentinelOptions) {
|
||||
let client = this.createConnection(listenAddress.address, listenAddress.port, auth, configRaw, false, true);
|
||||
// this is a sentinel connection, remove db
|
||||
let client = this.createConnection(listenAddress.address, listenAddress.port, auth, configRaw, false, true, true);
|
||||
|
||||
client.on('ready', () => {
|
||||
client.call('sentinel', 'get-master-addr-by-name', configRaw.sentinelOptions.masterName).then(reply => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user