fix: Enforce a 24-hour maximum session duration#470
fix: Enforce a 24-hour maximum session duration#470marandaneto wants to merge 9 commits intomainfrom
Conversation
…em.currentTimeMillis()
posthog-android Compliance ReportDate: 2026-03-27 15:36:37 UTC ✅ All Tests Passed!0/0 tests passed |
| if (postHog?.isSessionReplayActive() == true) { | ||
| postHog?.stopSessionReplay() | ||
|
|
||
| // startSessionReplay will rotate the session id internally | ||
| postHog?.startSessionReplay(resumeCurrent = false) |
There was a problem hiding this comment.
i need to do this here so all the snapshots and caching are cleared up from the previous sessions and wont leak to the new one
| if (PostHogSessionManager.isSessionExceedingMaxDuration(currentTimeMillis)) { | ||
| cancelTask() | ||
| postHog?.endSession() | ||
| postHog?.stopSessionReplay() |
There was a problem hiding this comment.
i have to check if i need to call postHog?.startSessionReplay during onStart now
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
|
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant. |
|
@ioannisj or @turnipdabeets this was done and just not tested, maybe needs a fix or something but should be almost there |
I can take a look after I get back from lunch :) |
|
Continuing this in #494 — GitHub wouldn't allow reopening after the rebase + force-push. |
💡 Motivation and Context
Enforce a 24-hour maximum session duration. When a session exceeds 24 hours, it is automatically rotated to a new one. This prevents excessively long sessions from accumulating unbounded data.
Closes #220
💚 How did you test it?
rotateSession(),getSessionStartedAt(), andsessionStartedAtlifecycle inPostHogSessionManagerTest.PostHogLifecycleObserverIntegrationTestverifying:PostHogDateProviderfor time mocking to make tests deterministic.make checkFormat— all formatting checks pass.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file