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

drop_running_worker.rb « stuck_builds « ci « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db571fdc38dd4a23d28499cb63d2aa503e5e0fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module Ci
  module StuckBuilds
    class DropRunningWorker
      include ApplicationWorker
      include ExclusiveLeaseGuard

      idempotent!

      # rubocop:disable Scalability/CronWorkerContext
      # This is an instance-wide cleanup query, so there's no meaningful
      # scope to consider this in the context of.
      include CronjobQueue
      # rubocop:enable Scalability/CronWorkerContext

      data_consistency :always

      feature_category :continuous_integration

      def perform
        try_obtain_lease do
          Ci::StuckBuilds::DropRunningService.new.execute
        end
      end

      private

      def lease_timeout
        30.minutes
      end
    end
  end
end