mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 22:47:12 +03:00
Fix undefined redis timeout breaking redis
This commit is contained in:
@@ -33,9 +33,9 @@ if (config.redis?.enabled) {
|
|||||||
|
|
||||||
const get = client.get.bind(client);
|
const get = client.get.bind(client);
|
||||||
exportClient.get = (key) => new Promise((resolve, reject) => {
|
exportClient.get = (key) => new Promise((resolve, reject) => {
|
||||||
const timeout = setTimeout(() => reject(), config.redis.getTimeout);
|
const timeout = config.redis.getTimeout ? setTimeout(() => reject(), config.redis.getTimeout) : null;
|
||||||
get(key).then((reply) => {
|
get(key).then((reply) => {
|
||||||
clearTimeout(timeout);
|
if (timeout !== null) clearTimeout(timeout);
|
||||||
resolve(reply);
|
resolve(reply);
|
||||||
}).catch((err) => reject(err));
|
}).catch((err) => reject(err));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user