move all logic in event.controller to worker (speed up request)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
"bullmq": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/sdk": "workspace:*",
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
import { Queue } from 'bullmq';
|
||||
|
||||
import type { IServiceCreateEventPayload } from '@openpanel/db';
|
||||
import type { PostEventPayload } from '@openpanel/sdk';
|
||||
|
||||
import { connection } from './connection';
|
||||
|
||||
export interface EventsQueuePayloadIncomingEvent {
|
||||
type: 'incomingEvent';
|
||||
payload: {
|
||||
projectId: string;
|
||||
event: PostEventPayload;
|
||||
geo: {
|
||||
country: string | undefined;
|
||||
city: string | undefined;
|
||||
region: string | undefined;
|
||||
continent: string | undefined;
|
||||
};
|
||||
headers: {
|
||||
origin: string | undefined;
|
||||
ua: string | undefined;
|
||||
};
|
||||
currentDeviceId: string;
|
||||
previousDeviceId: string;
|
||||
};
|
||||
}
|
||||
export interface EventsQueuePayloadCreateEvent {
|
||||
type: 'createEvent';
|
||||
payload: Omit<IServiceCreateEventPayload, 'id'>;
|
||||
@@ -14,7 +34,8 @@ export interface EventsQueuePayloadCreateSessionEnd {
|
||||
}
|
||||
export type EventsQueuePayload =
|
||||
| EventsQueuePayloadCreateEvent
|
||||
| EventsQueuePayloadCreateSessionEnd;
|
||||
| EventsQueuePayloadCreateSessionEnd
|
||||
| EventsQueuePayloadIncomingEvent;
|
||||
|
||||
export interface CronQueuePayload {
|
||||
type: 'salt';
|
||||
|
||||
Reference in New Issue
Block a user