Class: PruneWebHookLogsWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, CronjobQueue
Defined in:
app/workers/prune_web_hook_logs_worker.rb

Overview

Worker that deletes a fixed number of outdated rows from the “web_hook_logs” table.

Constant Summary collapse

DELETE_LIMIT =

The maximum number of rows to remove in a single job.

50_000

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#performObject


17
18
19
20
21
# File 'app/workers/prune_web_hook_logs_worker.rb', line 17

def perform
  cutoff_date = 90.days.ago.beginning_of_day

  WebHookLog.created_before(cutoff_date).delete_with_limit(DELETE_LIMIT)
end