fix(microservices): close underlying server once if already terminated

This commit is contained in:
Kamil Myśliwiec
2022-08-16 11:06:31 +02:00
parent 3fa86001f3
commit 394de8949c

View File

@@ -166,10 +166,10 @@ export class NestMicroservice
}
protected async dispose(): Promise<void> {
await this.server.close();
if (this.isTerminated) {
return;
}
await this.server.close();
this.socketModule && (await this.socketModule.close());
this.microservicesModule && (await this.microservicesModule.close());
}