(
channelId: string,
eventIds: string[],
buildFilter: (
channelId: string,
eventIds: string[],
) => RelaySubscriptionFilter,
)
| 199 | } |
| 200 | |
| 201 | private async fetchChunkedAuxEvents( |
| 202 | channelId: string, |
| 203 | eventIds: string[], |
| 204 | buildFilter: ( |
| 205 | channelId: string, |
| 206 | eventIds: string[], |
| 207 | ) => RelaySubscriptionFilter, |
| 208 | ): Promise<RelayEvent[]> { |
| 209 | if (eventIds.length === 0) { |
| 210 | return []; |
| 211 | } |
| 212 | |
| 213 | await this.ensureConnected(); |
| 214 | |
| 215 | const chunks: string[][] = []; |
| 216 | for (let i = 0; i < eventIds.length; i += AUX_BACKFILL_CHUNK_SIZE) { |
| 217 | chunks.push(eventIds.slice(i, i + AUX_BACKFILL_CHUNK_SIZE)); |
| 218 | } |
| 219 | |
| 220 | const batches: RelayEvent[][] = []; |
| 221 | for (const ids of chunks) { |
| 222 | batches.push(await this.requestHistory(buildFilter(channelId, ids))); |
| 223 | } |
| 224 | |
| 225 | return batches.flat(); |
| 226 | } |
| 227 | |
| 228 | private async fetchHistory(filter: RelaySubscriptionFilter) { |
| 229 | await this.ensureConnected(); |
no test coverage detected