From 89279dbfbbdd46433766d87a85bd122dd6e8b8bd Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Wed, 8 Jun 2022 13:17:08 +0200 Subject: [PATCH] set chunk size --- .../src/client/community/fetch-channel-chat-messages.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/status-js/src/client/community/fetch-channel-chat-messages.ts b/packages/status-js/src/client/community/fetch-channel-chat-messages.ts index a5b91ffb..f11ad795 100644 --- a/packages/status-js/src/client/community/fetch-channel-chat-messages.ts +++ b/packages/status-js/src/client/community/fetch-channel-chat-messages.ts @@ -5,8 +5,8 @@ import { handleChannelChatMessage } from './delete_handle-channel-chat-message' import type { MessageType } from './community' import type { Waku } from 'js-waku' -const CHUNK_SIZE = 2 -const PAGE_SIZE = 2 +const CHUNK_SIZE = 50 +const PAGE_SIZE = CHUNK_SIZE export const fetchChannelChatMessages = async ( waku: Waku, @@ -86,6 +86,7 @@ export async function fetchMessages( } } + // todo?: remove chunking until PAGE_SIZE !== CHUNK_SIZE while (remainingFetchedMessages.length >= CHUNK_SIZE) { // reverse const _chunk = remainingFetchedMessages.splice(0, CHUNK_SIZE).reverse()