summaryrefslogtreecommitdiff
path: root/app/models/namespace/aggregation_schedule.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/namespace/aggregation_schedule.rb')
-rw-r--r--app/models/namespace/aggregation_schedule.rb13
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..cd7d4fc409a 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)
+ 30.minutes.to_i
+ else
+ 1.hour.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