feature(api,worker): Override default timestamp with a date from the past (#76)

* feature(worker,api): refactor incoming events and support custom timestamps from the past

* fix(queue): add retry logic to events queue

* fix(worker): remove properties when merging server events
This commit is contained in:
Carl-Gerhard Lindesvärd
2024-10-22 10:25:21 +02:00
committed by GitHub
parent c4a2ea4858
commit 4fe338c628
6 changed files with 271 additions and 248 deletions

View File

@@ -10,6 +10,7 @@ export interface EventsQueuePayloadIncomingEvent {
projectId: string;
event: TrackPayload & {
timestamp: string;
isTimestampFromThePast: boolean;
};
geo: {
country: string | undefined;
@@ -71,6 +72,11 @@ export const eventsQueue = new Queue<EventsQueuePayload>('events', {
connection: getRedisQueue(),
defaultJobOptions: {
removeOnComplete: 10,
attempts: 3,
backoff: {
type: 'exponential',
delay: 1000,
},
},
});