Class: Ci::UnlockPipelinesInQueueWorker
- Inherits:
-
Object
- Object
- Ci::UnlockPipelinesInQueueWorker
- Defined in:
- app/workers/ci/unlock_pipelines_in_queue_worker.rb
Constant Summary collapse
- MAX_RUNNING_EXTRA_LOW =
10- MAX_RUNNING_LOW =
50- MAX_RUNNING_MEDIUM =
500- MAX_RUNNING_HIGH =
1500
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from LimitedCapacity::Worker
#perform, #remove_failed_jobs, #report_prometheus_metrics
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#max_running_jobs ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/workers/ci/unlock_pipelines_in_queue_worker.rb', line 44 def max_running_jobs if ::Feature.enabled?(:ci_unlock_pipelines_high, type: :ops) MAX_RUNNING_HIGH elsif ::Feature.enabled?(:ci_unlock_pipelines_medium, type: :ops) MAX_RUNNING_MEDIUM elsif ::Feature.enabled?(:ci_unlock_pipelines_extra_low, type: :ops) MAX_RUNNING_EXTRA_LOW elsif ::Feature.enabled?(:ci_unlock_pipelines, type: :ops) # This is the default enabled flag MAX_RUNNING_LOW else 0 end end |
#perform_work(*_) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/workers/ci/unlock_pipelines_in_queue_worker.rb', line 20 def perform_work(*_) pipeline_id, = Ci::UnlockPipelineRequest.next! return (:remaining_pending, 0) unless pipeline_id Ci::Pipeline.find_by_id(pipeline_id).try do |pipeline| (:pipeline_id, pipeline.id) (:project, pipeline.project.full_path) result = Ci::UnlockPipelineService.new(pipeline).execute (:unlock_wait_time, Time.current.utc.to_i - ) (:remaining_pending, Ci::UnlockPipelineRequest.total_pending) (:skipped_already_leased, result[:skipped_already_leased]) (:skipped_already_unlocked, result[:skipped_already_unlocked]) (:exec_timeout, result[:exec_timeout]) (:unlocked_job_artifacts, result[:unlocked_job_artifacts]) (:unlocked_pipeline_artifacts, result[:unlocked_pipeline_artifacts]) end end |
#remaining_work_count(*_) ⇒ Object
40 41 42 |
# File 'app/workers/ci/unlock_pipelines_in_queue_worker.rb', line 40 def remaining_work_count(*_) Ci::UnlockPipelineRequest.total_pending end |