disconnect ws error event after promise resolves

This commit is contained in:
Hazelnoot 2025-08-15 23:33:44 -04:00
parent 4f68bbfd52
commit f93693535e

View file

@ -322,11 +322,13 @@ export class StreamingApiServerService implements OnApplicationShutdown {
await new Promise<void>((resolve, reject) => {
this.#wss.close(err => {
this.#wss.off('error', this.onWsError);
if (err) reject(err);
else resolve();
});
});
// Don't disconnect this until *after* close returns
this.#wss.off('error', this.onWsError);
}
@bindThis