Skip to content

Commit

Permalink
feat(core): switch to BeforeApplicationShutdown hook
Browse files Browse the repository at this point in the history
This seems to give more consistent results when cleaning up.

Signed-off-by: Will Soto <[email protected]>
  • Loading branch information
willsoto committed Jul 28, 2020
1 parent e8a7207 commit 214e620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/core.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
BeforeApplicationShutdown,
DynamicModule,
FactoryProvider,
Inject,
Module,
OnApplicationShutdown,
Provider,
ValueProvider,
} from "@nestjs/common";
Expand All @@ -23,7 +23,7 @@ import {
} from "./interfaces";

@Module({})
export class ObjectionCoreModule implements OnApplicationShutdown {
export class ObjectionCoreModule implements BeforeApplicationShutdown {
constructor(
@Inject(OBJECTION_MODULE_OPTIONS)
private options: ObjectionModuleOptions,
Expand Down Expand Up @@ -153,7 +153,7 @@ export class ObjectionCoreModule implements OnApplicationShutdown {
};
}

async onApplicationShutdown(): Promise<void> {
async beforeApplicationShutdown(): Promise<void> {
await this.disconnect();
}

Expand Down
9 changes: 0 additions & 9 deletions tests/constants.spec.ts

This file was deleted.

0 comments on commit 214e620

Please sign in to comment.