Welcome to mirror list, hosted at ThFree Co, Russian Federation.

prune_stale_project_export_jobs.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3b4b55276fad7e2f1c21a16107c6d21e70110595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # Background migration for deleting stale project import jobs
    class PruneStaleProjectExportJobs < BatchedMigrationJob
      EXPIRES_IN = 7.days

      scope_to ->(relation) { relation.where("updated_at < ?", EXPIRES_IN.ago) }
      operation_name :delete_all
      feature_category :database

      def perform
        each_sub_batch(&:delete_all)
      end
    end
  end
end