Class: Projects::RefreshBuildArtifactsSizeStatisticsWorker
- Inherits:
-
Object
- Object
- Projects::RefreshBuildArtifactsSizeStatisticsWorker
- Includes:
- ApplicationWorker, LimitedCapacity::Worker
- Defined in:
- app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb
Constant Summary collapse
- MAX_RUNNING_LOW =
1
- MAX_RUNNING_MEDIUM =
3
- MAX_RUNNING_HIGH =
5
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
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
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb', line 40 def max_running_jobs if ::Feature.enabled?(:projects_build_artifacts_size_refresh_high, type: :ops) MAX_RUNNING_HIGH elsif ::Feature.enabled?(:projects_build_artifacts_size_refresh_medium, type: :ops) MAX_RUNNING_MEDIUM elsif ::Feature.enabled?(:projects_build_artifacts_size_refresh, type: :ops) MAX_RUNNING_LOW else 0 end end |
#perform_work(*args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb', line 18 def perform_work(*args) refresh = Projects::RefreshBuildArtifactsSizeStatisticsService.new.execute return unless refresh (:refresh_id, refresh.id) (:project_id, refresh.project_id) (:last_job_artifact_id, refresh.last_job_artifact_id) (:last_batch, refresh.destroyed?) (:refresh_started_at, refresh.refresh_started_at) end |
#remaining_work_count(*args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb', line 29 def remaining_work_count(*args) # LimitedCapacity::Worker only needs to know if there is work left to do # so we can get by with an EXISTS query rather than a count. # https://gitlab.com/gitlab-org/gitlab/-/issues/356167 if Projects::BuildArtifactsSizeRefresh.remaining.any? 1 else 0 end end |