Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugins): correctly fetch shouldRecord from store and clean up old store entries #514

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

kwalker3690
Copy link

Summary

This PR includes two changes:

  1. Correctly fetch shouldRecord from the store - previously we were only using the value if it was set to false, we need to know if a previous decision has been made that the session should be recorded as well.
  2. Clean up the IDB store upon sending events, getting rid of session data that is older than 3 days. Average session durations are usually in the minutes-range, so a buffer of days should ensure that we are not evicting still relevant data for most sessions. But this cleanup will help ensure that the IDB storage doesn't unnecessarily bloat for customer's sites, which could potentially cause issues if they (or other services they use) also want to make use of IDB.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: no

Copy link

@kickerbear kickerbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good thinking with cleaning up the indexedDB!

Copy link

@jackson-amplitude jackson-amplitude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nothing to worry about now, but something to think about. I wonder if we can use some sort of hash function that converts the session id string to a number between 0-1. that way the decision is just based on the session id and doesn't need to be stored, reducing complexity.

@kwalker3690 kwalker3690 merged commit 1e2a754 into v1.x Aug 1, 2023
@kwalker3690 kwalker3690 deleted the kwallach/session-cleanup branch August 1, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants