diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 12:13:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 12:13:39 +0300 |
commit | bfd344aeac677543c2a2f623fd103d4cf0f4e247 (patch) | |
tree | b798e8174a0519a31b97bcd7d2dab8258d0520aa /app/models/projects | |
parent | 2baf0eca39c55603848b667087cfd0471c5ac9bb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/projects')
-rw-r--r-- | app/models/projects/build_artifacts_size_refresh.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/projects/build_artifacts_size_refresh.rb b/app/models/projects/build_artifacts_size_refresh.rb index dee4afdefa6..e66e1d5b42f 100644 --- a/app/models/projects/build_artifacts_size_refresh.rb +++ b/app/models/projects/build_artifacts_size_refresh.rb @@ -2,6 +2,7 @@ module Projects class BuildArtifactsSizeRefresh < ApplicationRecord + include AfterCommitQueue include BulkInsertSafe STALE_WINDOW = 2.hours @@ -52,6 +53,8 @@ module Projects scope :remaining, -> { with_state(:created, :pending).or(stale) } scope :processing_queue, -> { remaining.order(state: :desc) } + after_destroy :schedule_namespace_aggregation_worker + def self.enqueue_refresh(projects) now = Time.zone.now @@ -93,5 +96,13 @@ module Projects def started? !created? end + + private + + def schedule_namespace_aggregation_worker + run_after_commit do + Namespaces::ScheduleAggregationWorker.perform_async(project.namespace_id) + end + end end end |