Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix(buffer): tmp lower inserts

Carl-Gerhard Lindesvärda3f39b95d246
diff --git a/packages/db/src/buffers/event-buffer.ts b/packages/db/src/buffers/event-buffer.ts
index d9e5346ef..31fc90316 100644
--- a/packages/db/src/buffers/event-buffer.ts
+++ b/packages/db/src/buffers/event-buffer.ts
@@ -231,12 +231,13 @@ export class EventBuffer extends RedisBuffer<BufferType> {
}
protected async insertIntoDB(items: BufferType[]): Promise<void> {
- for (const chunk of this.getChunks(items, 1500)) {
+ for (const chunk of this.getChunks(items, 500)) {
await ch.insert({
table: TABLE_NAMES.events,
values: chunk,
format: 'JSONEachRow',
});
+ await new Promise((resolve) => setTimeout(resolve, 50));
}
}