Skip to content
Snippets Groups Projects

Extend Events lifetime to 3 years instead of 2

Merged Imre Farkas requested to merge if-avoid_pruning_events into master
1 unresolved thread

What does this MR do?

Temporary solution until #24538 (closed) is implemented.

Closes #33840 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Jeremy Watson (ex-GitLab)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
6 6
7 7 # rubocop: disable CodeReuse/ActiveRecord
8 8 def perform
9 # Contribution calendar shows maximum 12 months of events, we retain 2 years for data integrity.
9 # Contribution calendar shows maximum 12 months of events, we retain 3 years for data integrity.
10 10 # Double nested query is used because MySQL doesn't allow DELETE subqueries on the same table.
11 11 Event.unscoped.where(
12 12 '(id IN (SELECT id FROM (?) ids_to_remove))',
13 13 Event.unscoped.where(
14 14 'created_at < ?',
15 (2.years + 1.day).ago)
15 (3.years + 1.day).ago)
  • mentioned in issue #119109 (closed)

  • Please register or sign in to reply
    Loading