diff --git a/CHANGELOG.md b/CHANGELOG.md index 3512ab6d81..82216f4d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ * Fix issues with recreating general channel when deleted while offline ([#2334](https://github.com/TryQuiet/quiet/issues/2334)) * Fix package.json license inconsistency * Fixes issue with reconnecting to peers on resume on iOS ([#2424](https://github.com/TryQuiet/quiet/issues/2424)) +* Reorder the closing of services, prevent sagas running multiple times and close backend server properly [2.1.2] diff --git a/packages/backend/src/nest/socket/socket.service.ts b/packages/backend/src/nest/socket/socket.service.ts index b7d1a46e0b..9d34f37dd6 100644 --- a/packages/backend/src/nest/socket/socket.service.ts +++ b/packages/backend/src/nest/socket/socket.service.ts @@ -203,9 +203,6 @@ export class SocketService extends EventEmitter implements OnModuleInit { // Ensure the underlying connections get closed. See: // https://github.com/socketio/socket.io/issues/1602 - // - // I also tried `this.serverIoProvider.io.disconnectSockets(true)` - // which didn't work for me. this.serverIoProvider.server.on('connection', conn => { this.sockets.add(conn) conn.on('close', () => { @@ -225,8 +222,12 @@ export class SocketService extends EventEmitter implements OnModuleInit { // Ensure the underlying connections get closed. See: // https://github.com/socketio/socket.io/issues/1602 + // + // I also tried `this.serverIoProvider.io.disconnectSockets(true)` + // which didn't work for me, but we still call it. public closeSockets = () => { this.logger('Disconnecting sockets') + this.serverIoProvider.io.disconnectSockets(true) this.sockets.forEach(s => s.destroy()) } @@ -269,7 +270,6 @@ export class SocketService extends EventEmitter implements OnModuleInit { resolve() }) - this.serverIoProvider.io.disconnectSockets(true) this.closeSockets() }) }