This commit is contained in:
2026-04-17 17:15:33 -04:00
parent c8fa99c6d2
commit 6f118107d9
16 changed files with 128 additions and 18 deletions

View File

@@ -372,7 +372,10 @@ class IngestorWorker {
if (candles.length > 0) {
const metadata = { request_id: requestId, client_id, ticker, period_seconds, start_time, end_time };
const PAGE_SIZE = 1000;
// 8000 rows/page: each OHLC row is ~77 bytes typical (9 populated fields as
// protobuf varints + ticker string). Worst-case is ~124 bytes, so 8000 rows
// stays safely under Kafka's 1MB message limit in all realistic scenarios.
const PAGE_SIZE = 8000;
for (let i = 0; i < candles.length; i += PAGE_SIZE) {
const page = candles.slice(i, i + PAGE_SIZE);
const isLastPage = (i + PAGE_SIZE) >= candles.length;