Files
stats/packages/db/src/buffers/bot-buffer.ts
Carl-Gerhard Lindesvärd 7a0e50a764 fix(buffer): use correct name
2024-09-20 09:38:49 +02:00

19 lines
520 B
TypeScript

import { TABLE_NAMES, ch } from '../clickhouse-client';
import type { IClickhouseBotEvent } from '../services/event.service';
import { RedisBuffer } from './buffer';
type BufferType = IClickhouseBotEvent;
export class BotBuffer extends RedisBuffer<BufferType> {
constructor() {
super(TABLE_NAMES.events_bots, 500);
}
protected async insertIntoDB(items: BufferType[]): Promise<void> {
await ch.insert({
table: TABLE_NAMES.events_bots,
values: items,
format: 'JSONEachRow',
});
}
}