SudoSOS Back-end API / internal/helpers / initRedisConnection
Function: initRedisConnection() ​
ts
function initRedisConnection(logger): Promise<Redis>;Try to connect to Redis. If it is unreachable in non-production environments, resolves to undefined so callers can fall back to direct SMTP sending. In production a missing Redis connection is a hard failure.
Mirrors the behaviour previously inlined in src/index.ts: wait for the connection to become ready, attach a persistent error handler so post-startup Redis errors are logged rather than crashing the process, and clean up the client on failure so the event loop is not kept alive unnecessarily.
Parameters ​
| Parameter | Type |
|---|---|
logger | Logger |
Returns ​
Promise<Redis>