Class: PruneOldEventsWorker
- Inherits:
-
Object
- Object
- PruneOldEventsWorker
- Includes:
- ApplicationWorker, CronjobQueue
- Defined in:
- app/workers/prune_old_events_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- DELETE_LIMIT =
10_000
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/workers/prune_old_events_worker.rb', line 17 def perform if Feature.enabled?(:ops_prune_old_events, type: :ops) # Contribution calendar shows maximum 12 months of events, we retain 3 years for data integrity. cutoff_date = (3.years + 1.day).ago Event.unscoped.created_before(cutoff_date).delete_with_limit(DELETE_LIMIT) else Gitlab::AppLogger.info(":ops_prune_old_events is disabled, skipping.") end end |