Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#492): use onApplicationShutdown instead of onModuleDestroy #493

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ typings/
dist
.idea
.DS_Store
.turbo
6 changes: 3 additions & 3 deletions packages/redlock/src/redlock.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Module, OnModuleDestroy } from "@nestjs/common";
import { Inject, Module, OnApplicationShutdown } from "@nestjs/common";
import { RedlockModuleOptions } from "./redlock.interface";
import { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } from "./redlock.module-definition";
import { RedlockService } from "./redlock.service";
Expand All @@ -13,12 +13,12 @@ import { RedlockService } from "./redlock.service";
],
exports: [RedlockService],
})
export class RedlockModule extends ConfigurableModuleClass implements OnModuleDestroy {
export class RedlockModule extends ConfigurableModuleClass implements OnApplicationShutdown {
constructor(@Inject(MODULE_OPTIONS_TOKEN) private readonly options: RedlockModuleOptions) {
super();
}

public async onModuleDestroy(): Promise<void> {
public async onApplicationShutdown(): Promise<void> {
for (const client of this.options.clients) {
switch (client.status) {
case "end":
Expand Down
6 changes: 3 additions & 3 deletions packages/simple-redlock/src/redlock.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Module, OnModuleDestroy } from "@nestjs/common";
import { Inject, Module, OnApplicationShutdown } from "@nestjs/common";
import { SimpleRedlockModuleOptions } from "./redlock.interface";
import { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } from "./redlock.module-definition";
import { SimpleRedlockService } from "./redlock.service";
Expand All @@ -13,12 +13,12 @@ import { SimpleRedlockService } from "./redlock.service";
],
exports: [SimpleRedlockService],
})
export class SimpleRedlockModule extends ConfigurableModuleClass implements OnModuleDestroy {
export class SimpleRedlockModule extends ConfigurableModuleClass implements OnApplicationShutdown {
constructor(@Inject(MODULE_OPTIONS_TOKEN) private readonly options: SimpleRedlockModuleOptions) {
super();
}

public async onModuleDestroy(): Promise<void> {
public async onApplicationShutdown(): Promise<void> {
switch (this.options.client.status) {
case "end":
break;
Expand Down