Created
March 8, 2022 17:42
-
-
Save mark-b-ab/8f74919944d5dac9330ff864a7ed9f6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module, OnApplicationShutdown, OnModuleDestroy } from '@nestjs/common'; | |
import { setTimeout } from 'timers/promises'; | |
@Module({}) | |
export class AppModule implements OnModuleDestroy, OnApplicationShutdown { | |
async onApplicationShutdown(signal?: string) { | |
console.log('onApplicationShutdown', signal); | |
} | |
async onModuleDestroy() { | |
console.log('onModuleDestroy before wait'); | |
await setTimeout(2000); | |
console.log('onModuleDestroy after wait'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment