Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Leblow committed May 7, 2024
1 parent 0060adc commit 467d988
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/backend/src/nest/socket/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -252,6 +252,13 @@ export class SocketService extends EventEmitter implements OnModuleInit {
public close = (): Promise<void> => {
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')
Expand Down

0 comments on commit 467d988

Please sign in to comment.