set chunk size

This commit is contained in:
Felicio Mununga 2022-06-08 13:17:08 +02:00
parent bd60c88767
commit 89279dbfbb
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 3 additions and 2 deletions

View File

@ -5,8 +5,8 @@ import { handleChannelChatMessage } from './delete_handle-channel-chat-message'
import type { MessageType } from './community' import type { MessageType } from './community'
import type { Waku } from 'js-waku' import type { Waku } from 'js-waku'
const CHUNK_SIZE = 2 const CHUNK_SIZE = 50
const PAGE_SIZE = 2 const PAGE_SIZE = CHUNK_SIZE
export const fetchChannelChatMessages = async ( export const fetchChannelChatMessages = async (
waku: Waku, waku: Waku,
@ -86,6 +86,7 @@ export async function fetchMessages(
} }
} }
// todo?: remove chunking until PAGE_SIZE !== CHUNK_SIZE
while (remainingFetchedMessages.length >= CHUNK_SIZE) { while (remainingFetchedMessages.length >= CHUNK_SIZE) {
// reverse // reverse
const _chunk = remainingFetchedMessages.splice(0, CHUNK_SIZE).reverse() const _chunk = remainingFetchedMessages.splice(0, CHUNK_SIZE).reverse()