-
Notifications
You must be signed in to change notification settings - Fork 75
[User Session] Clear metadata on older sessions #10751
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
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…hod for clearing old sessions
… method for clearing old sessions
|
done! let me know if any further changes are needed, ty! |
| def clear_metadata! | ||
| update_columns( | ||
| device_info: nil, | ||
| latitude: nil, | ||
| longitude: nil, | ||
| ) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to use update to update! so that callbacks/validations run? Any thoughts @davidcornu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to use
updatetoupdate!so that callbacks/validations run?
Inclined to say yes unless we have a good reason not to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i'm on the same page.
typo in first message: to -> or*
### Closes hackclub#10744 This pull request introduces a new background job to clear outdated user session data and schedules it to run daily. The job ensures sensitive session information is removed for sessions older than one year. Below are the most important changes: ### Addition of a new job: * [`app/jobs/user/clear_old_user_sessions_job.rb`](diffhunk://#diff-19bd9b2978ef88bf9ae1db00fbb346141d92e5d85c4cb816b8949d814f0c4792R1-R21): Added a new job `ClearOldUserSessionsJob` to the `User` namespace. This job iterates through user sessions older than one year and clears sensitive data such as `device_info`, `os_info`, `timezone`, `ip`, and location details (`latitude` and `longitude`). ### Scheduling the job: * [`config/schedule.yml`](diffhunk://#diff-18c4a92c666266e8bead5b6ddb034501022877cdf773c0d337499ed0a7f6d341R175-R179): Scheduled the new `ClearOldUserSessionsJob` to run daily at 3:00 AM with a low priority queue. [Internal discussion](https://hackclub.slack.com/archives/C047Y01MHJQ/p1750259883680629) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gary Tou <[email protected]>
Closes #10744
This pull request introduces a new background job to clear outdated user session data and schedules it to run daily. The job ensures sensitive session information is removed for sessions older than one year. Below are the most important changes:
Addition of a new job:
app/jobs/user/clear_old_user_sessions_job.rb: Added a new jobClearOldUserSessionsJobto theUsernamespace. This job iterates through user sessions older than one year and clears sensitive data such asdevice_info,os_info,timezone,ip, and location details (latitudeandlongitude).Scheduling the job:
config/schedule.yml: Scheduled the newClearOldUserSessionsJobto run daily at 3:00 AM with a low priority queue.Internal discussion