From 467d988b9daf3582e18c3ee5d8c41a3ee2a985fa Mon Sep 17 00:00:00 2001 From: Lucas Leblow Date: Tue, 7 May 2024 09:31:09 -0600 Subject: [PATCH] Fixup --- packages/backend/src/nest/socket/socket.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/nest/socket/socket.service.ts b/packages/backend/src/nest/socket/socket.service.ts index 7e48861109..b0f5905715 100644 --- a/packages/backend/src/nest/socket/socket.service.ts +++ b/packages/backend/src/nest/socket/socket.service.ts @@ -240,7 +240,7 @@ export class SocketService extends EventEmitter implements OnModuleInit { return } - return await new Promise(resolve => { + return new Promise(resolve => { this.serverIoProvider.server.listen(this.configOptions.socketIOPort, '127.0.0.1', () => { this.logger(`Data server running on port ${this.configOptions.socketIOPort}`) this.listening = true @@ -252,6 +252,13 @@ export class SocketService extends EventEmitter implements OnModuleInit { public close = (): Promise => { return new Promise(resolve => { this.logger(`Closing data server on port ${this.configOptions.socketIOPort}`) + + if (!this.listening) { + this.logger('Data server is not running.') + resolve() + return + } + this.serverIoProvider.io.close(err => { if (err) throw new Error(err.message) this.logger('Data server closed')