2018-09-17 05:26:22 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
2020-02-19 13:09:10 -05:00
|
|
|
class BuildScheduleWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-09-17 05:26:22 -04:00
|
|
|
include ApplicationWorker
|
|
|
|
include PipelineQueue
|
|
|
|
|
2018-09-25 01:30:11 -04:00
|
|
|
queue_namespace :pipeline_processing
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :continuous_integration
|
2019-10-30 11:14:17 -04:00
|
|
|
worker_resource_boundary :cpu
|
2018-09-25 01:30:11 -04:00
|
|
|
|
2018-09-17 05:26:22 -04:00
|
|
|
def perform(build_id)
|
2018-09-24 07:02:26 -04:00
|
|
|
::Ci::Build.find_by_id(build_id).try do |build|
|
2018-09-25 01:30:11 -04:00
|
|
|
break unless build.scheduled?
|
|
|
|
|
2018-09-24 07:02:26 -04:00
|
|
|
Ci::RunScheduledBuildService
|
|
|
|
.new(build.project, build.user).execute(build)
|
2018-09-17 05:26:22 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|