mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 12:33:22 +00:00
add smart random
This commit is contained in:
@@ -29,10 +29,16 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
||||
async onModuleInit() {
|
||||
await this.$connect()
|
||||
}
|
||||
|
||||
async enableShutdownHooks(app: INestApplication) {
|
||||
this.$on('beforeExit', async () => {
|
||||
private exitHandler(app: INestApplication) {
|
||||
return async () => {
|
||||
await app.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
async enableShutdownHooks(app: INestApplication) {
|
||||
process.on('exit', this.exitHandler(app))
|
||||
process.on('beforeExit', this.exitHandler(app))
|
||||
process.on('SIGINT', this.exitHandler(app))
|
||||
process.on('SIGTERM', this.exitHandler(app))
|
||||
process.on('SIGUSR2', this.exitHandler(app))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user