From da26614033e3d0a1226630f70c6b8f3fb7d1316c Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Tue, 15 Jul 2025 14:00:27 +0200 Subject: [PATCH] backend: terminate process on Redis connection failure during startup --- backend/src/services/redis.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/services/redis.service.ts b/backend/src/services/redis.service.ts index e360b54..5fbf7d8 100644 --- a/backend/src/services/redis.service.ts +++ b/backend/src/services/redis.service.ts @@ -51,6 +51,12 @@ export class RedisService extends EventEmitter { const onError = (error: Error) => { this.logger.error('Redis Error', error); this.emit('redisError', error); + + // If Redis connection fails during startup, terminate the process + if (!this.isConnected) { + this.logger.error('Failed to connect to Redis during startup. Terminating process...'); + process.exit(1); + } }; const onDisconnect = () => {