diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-04 03:08:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-04 03:08:12 +0300 |
commit | e3bac3b0e2bcc39ba899bc38d946ceb6921b7c14 (patch) | |
tree | 85baf9c5b9daacfc3f6751ca3b146de83cb051dc /app/models/namespace | |
parent | b8fcc8edb4a289ef3ef4fee0ed8fd88e853a2396 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/namespace')
-rw-r--r-- | app/models/namespace/aggregation_schedule.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/models/namespace/aggregation_schedule.rb b/app/models/namespace/aggregation_schedule.rb index ed61c807519..72f5ab11060 100644 --- a/app/models/namespace/aggregation_schedule.rb +++ b/app/models/namespace/aggregation_schedule.rb @@ -6,13 +6,20 @@ class Namespace::AggregationSchedule < ApplicationRecord self.primary_key = :namespace_id - DEFAULT_LEASE_TIMEOUT = 1.5.hours.to_i REDIS_SHARED_KEY = 'gitlab:update_namespace_statistics_delay' belongs_to :namespace after_create :schedule_root_storage_statistics + def self.default_lease_timeout + if Feature.enabled?(:remove_namespace_aggregator_delay) + 1.hour.to_i + else + 1.5.hours.to_i + end + end + def schedule_root_storage_statistics run_after_commit_or_now do try_obtain_lease do @@ -20,7 +27,7 @@ class Namespace::AggregationSchedule < ApplicationRecord .perform_async(namespace_id) Namespaces::RootStatisticsWorker - .perform_in(DEFAULT_LEASE_TIMEOUT, namespace_id) + .perform_in(self.class.default_lease_timeout, namespace_id) end end end @@ -29,7 +36,7 @@ class Namespace::AggregationSchedule < ApplicationRecord # Used by ExclusiveLeaseGuard def lease_timeout - DEFAULT_LEASE_TIMEOUT + self.class.default_lease_timeout end # Used by ExclusiveLeaseGuard |