From cd1d7cee005d224364360dcb39cfc145748be5b2 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 1 Sep 2025 04:29:54 +0200 Subject: [PATCH] ignore drop after logout --- src/services/wsService.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/services/wsService.ts b/src/services/wsService.ts index 237d1de4..94246bf6 100644 --- a/src/services/wsService.ts +++ b/src/services/wsService.ts @@ -179,17 +179,15 @@ const wsOnConnect = (ws: ws, req: http.IncomingMessage): void => { logError(e as Error, `processing websocket message`); } }); - ws.on("close", () => { + // eslint-disable-next-line @typescript-eslint/no-misused-promises + ws.on("close", async () => { if ((ws as IWsCustomData).isGame && (ws as IWsCustomData).accountId) { logger.debug(`lost bootstrapper connection for ${(ws as IWsCustomData).accountId}`); - void Account.updateOne( - { - _id: (ws as IWsCustomData).accountId - }, - { - Dropped: true - } - ).then(() => {}); + const account = await Account.findOne({ _id: (ws as IWsCustomData).accountId }); + if (account?.Nonce) { + account.Dropped = true; + await account.save(); + } } }); };