[#112] Fix race condition with closing sessions
This commit is contained in:
parent
3fa023285b
commit
d46b86c631
|
@ -155,6 +155,11 @@ export class Session {
|
||||||
logError(err);
|
logError(err);
|
||||||
await this.teardown();
|
await this.teardown();
|
||||||
});
|
});
|
||||||
|
// User may have closed websocket before we were able to set up
|
||||||
|
// the onclose listener.
|
||||||
|
if (this.ws.readyState === WebSocket.CLOSED) {
|
||||||
|
await this.teardown();
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logError(err);
|
logError(err);
|
||||||
this.sendError(err);
|
this.sendError(err);
|
||||||
|
|
Loading…
Reference in New Issue