mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
new consumer
This commit is contained in:
@@ -6,6 +6,7 @@ export type TProjectCount = {
|
||||
events: number,
|
||||
visits: number,
|
||||
sessions: number,
|
||||
lastRecheck?: Date
|
||||
}
|
||||
|
||||
const ProjectCountSchema = new Schema<TProjectCount>({
|
||||
@@ -13,6 +14,7 @@ const ProjectCountSchema = new Schema<TProjectCount>({
|
||||
events: { type: Number, required: true, default: 0 },
|
||||
visits: { type: Number, required: true, default: 0 },
|
||||
sessions: { type: Number, required: true, default: 0 },
|
||||
lastRecheck: { type: Date }
|
||||
});
|
||||
|
||||
export const ProjectCountModel = model<TProjectCount>('project_counts', ProjectCountSchema);
|
||||
@@ -11,7 +11,7 @@ export type ReadingLoopOptions = {
|
||||
type xReadGroupMessage = { id: string, message: { [x: string]: string } }
|
||||
type xReadGgroupResult = { name: string, messages: xReadGroupMessage[] }[] | null
|
||||
|
||||
const consumerGroups = ['DATABASE', 'LIMITS'] as const;
|
||||
const consumerGroups = ['DATABASE'] as const;
|
||||
|
||||
type ConsumerGroup = typeof consumerGroups[number];
|
||||
|
||||
@@ -41,7 +41,6 @@ export class RedisStreamService {
|
||||
}
|
||||
|
||||
for (const entry of result) {
|
||||
console.log(`[${group_name}-${consumer_name}]`, 'Processing', entry.messages.length, 'messages');
|
||||
for (const messageData of entry.messages) {
|
||||
await process_function(messageData.message);
|
||||
await this.client.xAck(stream_name, group_name, messageData.id);
|
||||
|
||||
Reference in New Issue
Block a user