Files
zkldi_Tachi/server/src/external/redis/redis.ts
T
zkldi b79804d273 Fixing Random Test Failure (#309)
* Test 1: Async Wrapping

* Revert "Test 1: Async Wrapping"

This reverts commit 8f0e0d283686d367e18275684cc7858af0538515.

* Pin github actions node version to the same as ours

* Revert "Pin github actions node version to the same as ours"

This reverts commit 3758ee05ef5647f608ef3fd1c85b88eb97e3f077.

* Move lint step to after running tests

* add a NO_CONSOLE config option

* temporarily set log level to debug

* Enable more mongodb logging in testing

* Experimentally bundle before script into SPT.

* run without any before

* Revert "Experimentally bundle before script into SPT."

* Revert "Enable more mongodb logging in testing"

This reverts commit c11f918c850dc53cb49b262cb0b51141ac132aab.

* Fix missing import

* Re add the mongodb logging

* Set LOG_LEVEL back to reasonable levels

* Increase timeouts for mongo and redis connections

* Change how codecov works

* Use ServerSelectionTimeoutMS instead of connect

* pls?

* Bump TAP Timeout to 4 minutes, which we'll probably never hit.
2021-09-01 06:26:37 +01:00

29 lines
652 B
TypeScript

import CreateLogCtx from "lib/logger/logger";
import redis from "redis";
const logger = CreateLogCtx(__filename);
logger.verbose("Instantiated Redis Store");
export const RedisClient = redis.createClient();
logger.verbose("Instantiated Redis Client");
function EmitCritical() {
/* istanbul ignore next */
if (!RedisClient.connected) {
logger.crit(`Could not connect to redis in time. No more information is available.`);
}
}
const ref = setTimeout(EmitCritical, 30000);
RedisClient.on("connect", () => {
logger.verbose(`Connected to Redis.`);
clearTimeout(ref);
});
export function CloseRedisConnection() {
return RedisClient.quit();
}