MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / withinIdleWindow

Function withinIdleWindow

apps/api/src/utils/ids.ts:76–82  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

74 * closed one, breaking the id-based extension check in createSessionEnd.
75 */
76function 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
84async function getInfoFromSession({
85 projectId,

Callers 1

getInfoFromSessionFunction · 0.85

Calls 1

Tested by

no test coverage detected