Skip to content

Commit

Permalink
fix(core): switch to using onApplicationShutdown hook
Browse files Browse the repository at this point in the history
This matches what nestjs/typeorm does.

https://github.com/nestjs/typeorm/blob/9b67355a1f2d6d2bb44c240239d637e79c89b7f5/lib/typeorm-core.module.ts#L35
Signed-off-by: Will Soto <willsoto@users.noreply.github.com>
  • Loading branch information
willsoto committed Aug 27, 2020
1 parent 57c05ca commit bdf4ea1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/core.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
BeforeApplicationShutdown,
DynamicModule,
FactoryProvider,
Global,
Inject,
Module,
OnApplicationShutdown,
Provider,
ValueProvider,
} from "@nestjs/common";
Expand All @@ -25,7 +25,7 @@ import {

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

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

Expand Down

0 comments on commit bdf4ea1

Please sign in to comment.