Skip to content

Commit

Permalink
Die when pool errors part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Mar 21, 2024
1 parent 8ab9194 commit 47e937f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pool/pool.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 47e937f

Please sign in to comment.