From cad357fd2c9690a173cc9d3e424fd84739997574 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 30 Jun 2023 02:52:33 -0500 Subject: [PATCH] Remove debug logs --- .../matrix-utils/fetch-accessible-rooms.js | 46 +------------------ 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/server/lib/matrix-utils/fetch-accessible-rooms.js b/server/lib/matrix-utils/fetch-accessible-rooms.js index 2b39b07..f275828 100644 --- a/server/lib/matrix-utils/fetch-accessible-rooms.js +++ b/server/lib/matrix-utils/fetch-accessible-rooms.js @@ -61,11 +61,6 @@ async function fetchAccessibleRooms( assert(accessToken); assert([DIRECTION.forward, DIRECTION.backward].includes(direction), 'direction must be [f|b]'); - console.log( - `fetchAccessibleRooms searchTerm=${searchTerm} direction=${direction} paginationToken=${paginationToken} limit=${limit}\n` + - '--------------------------------' - ); - // Based off of the matrix.org room directory, only 42% of rooms are world_readable, // which means our best bet to fill up the results to the limit is to request 2.5 times as many. const bulkPaginationLimit = Math.ceil(2.5 * limit); @@ -100,22 +95,11 @@ async function fetchAccessibleRooms( lastLoopToken = loopToken; lastResponse = publicRoomsRes; - console.log( - `publicRoomsRes currentRequestCount=${currentRequestCount} direction=${direction}, publicRoomsRes=${JSON.stringify( - publicRoomsRes.chunk.map((room) => room.name), - null, - 2 - )}` - ); - if (currentRequestCount === 0) { firstResponse = publicRoomsRes; } - // Keep track of this as we go. For the final pagination token, we return to the - // client, we might need to back-track later to get the perfect continuation point - // if we find more than the limit of rooms we want to fetch. Alternatively, we could - // just not worry about and show more than the limit of rooms. + // Get the token ready for the next loop loopToken = direction === DIRECTION.forward ? publicRoomsRes.next_batch : publicRoomsRes.prev_batch; @@ -162,15 +146,6 @@ async function fetchAccessibleRooms( let nextPaginationToken; let prevPaginationToken; if (continuationIndex) { - // let continuationLimit; - // if (direction === DIRECTION.forward) { - // continuationLimit = continuationIndex + 1; - // } else if (direction === DIRECTION.backward) { - // continuationLimit = bulkPaginationLimit - continuationIndex; - // } else { - // throw new Error(`Invalid direction: ${direction}`); - // } - const publicRoomsRes = await requestPublicRooms(accessToken, { server, searchTerm, @@ -181,17 +156,6 @@ async function fetchAccessibleRooms( abortSignal, }); - console.log( - `publicRoomsRes back-track direction=${direction}, publicRoomsRes=${JSON.stringify( - publicRoomsRes.chunk.map((room) => room.name), - null, - 2 - )}` - ); - - // console.log('firstResponse', firstResponse.prev_batch, firstResponse.next_batch); - // console.log('back-track publicRoomsRes', publicRoomsRes.prev_batch, publicRoomsRes.next_batch); - if (direction === DIRECTION.forward) { prevPaginationToken = firstResponse.prev_batch; nextPaginationToken = publicRoomsRes.next_batch; @@ -213,14 +177,6 @@ async function fetchAccessibleRooms( } } - console.log( - `return accessibleRooms=${JSON.stringify( - accessibleRooms.map((room) => room.name), - null, - 2 - )}` - ); - return { rooms: accessibleRooms, prevPaginationToken,