fix(cli): clean up set intervals (#2103)

This commit is contained in:
Jason Rasmussen 2023-03-28 14:24:14 -04:00 committed by GitHub
parent da5a6d2272
commit 8563bd463c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
import { DynamicModule, Global, Module, ModuleMetadata, Provider } from '@nestjs/common';
import { DynamicModule, Global, Module, ModuleMetadata, OnApplicationShutdown, Provider } from '@nestjs/common';
import { AlbumService } from './album';
import { APIKeyService } from './api-key';
import { AssetService } from './asset';
@ -44,7 +44,9 @@ const providers: Provider[] = [
@Global()
@Module({})
export class DomainModule {
export class DomainModule implements OnApplicationShutdown {
constructor(private searchService: SearchService) {}
static register(options: Pick<ModuleMetadata, 'imports'>): DynamicModule {
return {
module: DomainModule,
@ -53,4 +55,8 @@ export class DomainModule {
exports: [...providers],
};
}
onApplicationShutdown() {
this.searchService.teardown();
}
}