Attempt to fix race condition on channel join

This commit is contained in:
Hri7566 2023-09-11 00:55:26 -04:00
parent 5b30fbcd94
commit 0e67fb52cf
1 changed files with 11 additions and 6 deletions

View File

@ -93,7 +93,8 @@ export class Socket extends EventEmitter {
this.id = foundSocket.id;
}
this.loadUser();
(async () => {
await this.loadUser();
// TODO Permissions
let isAdmin = false;
@ -101,6 +102,7 @@ export class Socket extends EventEmitter {
this.setRateLimits(isAdmin ? adminLimits : userLimits);
this.bindEventListeners();
})();
}
public getIP() {
@ -133,7 +135,10 @@ export class Socket extends EventEmitter {
// Does channel exist?
if (channel) {
// Exists, join normally
(async () => {
await this.loadUser();
channel.join(this);
})();
} else {
// Doesn't exist, create
channel = new Channel(