|
|
@ -358,14 +358,24 @@ exports.radius = function (
|
|
|
|
* Redis server ping
|
|
|
|
* Redis server ping
|
|
|
|
* @param {string} dsn The redis connection string
|
|
|
|
* @param {string} dsn The redis connection string
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
exports.redisPingAsync = async function (dsn) {
|
|
|
|
exports.redisPingAsync = function (dsn) {
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
const client = redis.createClient({
|
|
|
|
const client = redis.createClient({
|
|
|
|
url: dsn,
|
|
|
|
url: dsn,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
await client.connect();
|
|
|
|
client.on("error", (err) => {
|
|
|
|
const pong = await client.ping();
|
|
|
|
reject(err);
|
|
|
|
await client.disconnect();
|
|
|
|
});
|
|
|
|
return pong;
|
|
|
|
client.connect().then(() => {
|
|
|
|
|
|
|
|
client.ping().then((res, err) => {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
reject(err);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resolve(res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|