From 47e937f8429f51236eaa90fee6e859e946963364 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Wed, 20 Mar 2024 20:52:32 -0700 Subject: [PATCH] Die when pool errors part 2 --- src/pool/pool.module.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pool/pool.module.ts b/src/pool/pool.module.ts index 00ec45f..64ad85f 100644 --- a/src/pool/pool.module.ts +++ b/src/pool/pool.module.ts @@ -10,7 +10,12 @@ import {PoolService} from './pool.service'; exports: [PoolService] }) export class PoolModule implements OnApplicationShutdown { - constructor(private readonly moduleRef: ModuleRef) {} + constructor(private readonly moduleRef: ModuleRef) { + moduleRef.get(PoolService).on('error', error => { + // eslint-disable-next-line unicorn/no-process-exit + process.exit(1); + }); + } async onApplicationShutdown() { const pool = this.moduleRef.get(PoolService);