add buffer

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-06 11:04:51 +01:00
parent 0b5d4fa0d1
commit 8fd8b9319d
6 changed files with 213 additions and 3 deletions

View File

@@ -68,6 +68,11 @@ export async function bootCron() {
type: 'flushReplay',
pattern: 1000 * 10,
},
{
name: 'flush',
type: 'flushGroups',
pattern: 1000 * 10,
},
{
name: 'insightsDaily',
type: 'insightsDaily',

View File

@@ -1,6 +1,6 @@
import type { Job } from 'bullmq';
import { eventBuffer, profileBackfillBuffer, profileBuffer, replayBuffer, sessionBuffer } from '@openpanel/db';
import { eventBuffer, groupBuffer, profileBackfillBuffer, profileBuffer, replayBuffer, sessionBuffer } from '@openpanel/db';
import type { CronQueuePayload } from '@openpanel/queue';
import { jobdeleteProjects } from './cron.delete-projects';
@@ -30,6 +30,9 @@ export async function cronJob(job: Job<CronQueuePayload>) {
case 'flushReplay': {
return await replayBuffer.tryFlush();
}
case 'flushGroups': {
return await groupBuffer.tryFlush();
}
case 'ping': {
return await ping();
}