({
payload,
closedSession,
}: {
payload: IServiceCreateEventPayload;
closedSession: IClickhouseSession;
})
| 30 | * or by the reaper when a session has been idle past the timeout. |
| 31 | */ |
| 32 | export async function enqueueSessionEndV2({ |
| 33 | payload, |
| 34 | closedSession, |
| 35 | }: { |
| 36 | payload: IServiceCreateEventPayload; |
| 37 | closedSession: IClickhouseSession; |
| 38 | }) { |
| 39 | const jobId = getSessionEndJobIdV2(closedSession.id); |
| 40 | |
| 41 | return sessionsQueue.add( |
| 42 | 'session', |
| 43 | { |
| 44 | type: 'createSessionEnd', |
| 45 | payload: { |
| 46 | ...payload, |
| 47 | projectId: closedSession.project_id, |
| 48 | deviceId: closedSession.device_id, |
| 49 | sessionId: closedSession.id, |
| 50 | profileId: closedSession.profile_id || payload.profileId, |
| 51 | }, |
| 52 | snapshot: closedSession, |
| 53 | }, |
| 54 | { |
| 55 | jobId, |
| 56 | attempts: 3, |
| 57 | backoff: { |
| 58 | type: 'exponential', |
| 59 | delay: 200, |
| 60 | }, |
| 61 | } |
| 62 | ); |
| 63 | } |
no test coverage detected