chore(jetstream): log bulk-create record count on flush

This commit is contained in:
Julien Calixte
2026-05-05 12:52:27 +02:00
parent 8055060af3
commit 911d062423

View File

@@ -59,7 +59,7 @@ const fireWebhooks = async (
await dispatchAll(webhooks, payload, `${verb} ${did}`); await dispatchAll(webhooks, payload, `${verb} ${did}`);
}; };
const BULK_CREATE_DEBOUNCE_MS = 3000; const BULK_CREATE_DEBOUNCE_MS = 15000;
type BulkBuffer = { type BulkBuffer = {
records: Record<string, unknown>[]; records: Record<string, unknown>[];
@@ -72,6 +72,7 @@ const flushBulkCreate = async (did: string): Promise<void> => {
if (!buffer) return; if (!buffer) return;
bulkBuffers.delete(did); bulkBuffers.delete(did);
const webhooks = getWebhooksByDidAndVerb(did, "bulk-create"); const webhooks = getWebhooksByDidAndVerb(did, "bulk-create");
log(`[jetstream] bulk-create ${did}: ${buffer.records.length} record(s)`);
await dispatchAll( await dispatchAll(
webhooks, webhooks,
{ event: "bulk-create", did, records: buffer.records }, { event: "bulk-create", did, records: buffer.records },