* Returns true when an existing session is recent enough that the incoming * event should EXTEND it rather than start a new session. * * Critical: blobs no longer have a Redis TTL (so the reaper can always find * them), which means an existing session blob may linger past its idle * window. We
( session: IClickhouseSession, eventTimeMs: number )
| 74 | * closed one, breaking the id-based extension check in createSessionEnd. |
| 75 | */ |
| 76 | function withinIdleWindow( |
| 77 | session: IClickhouseSession, |
| 78 | eventTimeMs: number |
| 79 | ): boolean { |
| 80 | const lastEventMs = convertClickhouseDateToJs(session.ended_at).getTime(); |
| 81 | return eventTimeMs - lastEventMs < SESSION_TIMEOUT_MS; |
| 82 | } |
| 83 | |
| 84 | async function getInfoFromSession({ |
| 85 | projectId, |
no test coverage detected