summaryrefslogtreecommitdiff
path: root/app/workers/ci/stuck_builds/drop_scheduled_worker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/ci/stuck_builds/drop_scheduled_worker.rb')
-rw-r--r--app/workers/ci/stuck_builds/drop_scheduled_worker.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/app/workers/ci/stuck_builds/drop_scheduled_worker.rb b/app/workers/ci/stuck_builds/drop_scheduled_worker.rb
new file mode 100644
index 00000000000..923841771cf
--- /dev/null
+++ b/app/workers/ci/stuck_builds/drop_scheduled_worker.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+module Ci
+ module StuckBuilds
+ class DropScheduledWorker
+ 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::DropScheduledService.new.execute
+ end
+ end
+
+ private
+
+ def lease_timeout
+ 30.minutes
+ end
+ end
+ end
+end