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- CUTOFF_DATE =
Contribution calendar shows maximum 12 months of events, we retain 3 years for data integrity.
(3.years + 1.day).freeze
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Class Method Details
Instance Method Details
#perform ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/workers/prune_old_events_worker.rb', line 23 def perform if self.class.pruning_enabled? cutoff_date = CUTOFF_DATE.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 |