mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-01 01:25:45 -04:00
Merge pull request #3234 from kefoster951/fix_redis_auth
Fix redis authentication reattempt issue
This commit is contained in:
commit
dd77baabe1
@ -413,12 +413,18 @@ exports.radius = function (
|
|||||||
exports.redisPingAsync = function (dsn) {
|
exports.redisPingAsync = function (dsn) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const client = redis.createClient({
|
const client = redis.createClient({
|
||||||
url: dsn,
|
url: dsn
|
||||||
});
|
});
|
||||||
client.on("error", (err) => {
|
client.on("error", (err) => {
|
||||||
|
if (client.isOpen) {
|
||||||
|
client.disconnect();
|
||||||
|
}
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
client.connect().then(() => {
|
client.connect().then(() => {
|
||||||
|
if (!client.isOpen) {
|
||||||
|
client.emit("error", new Error("connection isn't open"));
|
||||||
|
}
|
||||||
client.ping().then((res, err) => {
|
client.ping().then((res, err) => {
|
||||||
if (client.isOpen) {
|
if (client.isOpen) {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
@ -428,7 +434,7 @@ exports.redisPingAsync = function (dsn) {
|
|||||||
} else {
|
} else {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
}
|
}
|
||||||
});
|
}).catch(error => reject(error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user