From 3513853df7900f433bb028527887f06725f7af67 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Wed, 6 Nov 2024 11:59:22 +0000 Subject: [PATCH] rooms: remove unnecessary promise nesting We have the release promise in an object, this is no-longer necessary. --- src/core/rooms.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/rooms.ts b/src/core/rooms.ts index a8afe3b0..410b60ad 100644 --- a/src/core/rooms.ts +++ b/src/core/rooms.ts @@ -87,7 +87,7 @@ export class DefaultRooms implements Rooms { private readonly _chatApi: ChatApi; private readonly _clientOptions: NormalizedClientOptions; private readonly _rooms: Map = new Map(); - private readonly _releasing = new Map }>(); + private readonly _releasing = new Map>(); private readonly _logger: Logger; /** @@ -154,7 +154,7 @@ export class DefaultRooms implements Rooms { abortController.signal.addEventListener('abort', abortListener); - releasing.promise + releasing .then(() => { // We aborted before resolution if (abortController.signal.aborted) { @@ -206,7 +206,7 @@ export class DefaultRooms implements Rooms { this._logger.debug('Rooms.release(); waiting for previous release call', { roomId, }); - return releasing.promise; + return releasing; } // If the room is not releasing, there is nothing else to do @@ -235,7 +235,7 @@ export class DefaultRooms implements Rooms { }); this._logger.debug('Rooms.release(); creating new release promise', { roomId, nonce: existing.nonce }); - this._releasing.set(roomId, { promise: releasePromise }); + this._releasing.set(roomId, releasePromise); return releasePromise; }