Class: Namespace::AggregationSchedule

Inherits:
ApplicationRecord show all
Includes:
AfterCommitQueue, ExclusiveLeaseGuard
Defined in:
app/models/namespace/aggregation_schedule.rb

Constant Summary collapse

DEFAULT_LEASE_TIMEOUT =
1.5.hours.to_i
REDIS_SHARED_KEY =
'gitlab:update_namespace_statistics_delay'

Instance Method Summary collapse

Methods included from ExclusiveLeaseGuard

#exclusive_lease, #log_error, #release_lease, #renew_lease!, #try_obtain_lease

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#schedule_root_storage_statisticsObject


16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/namespace/aggregation_schedule.rb', line 16

def schedule_root_storage_statistics
  run_after_commit_or_now do
    try_obtain_lease do
      Namespaces::RootStatisticsWorker
        .perform_async(namespace_id)

      Namespaces::RootStatisticsWorker
        .perform_in(DEFAULT_LEASE_TIMEOUT, namespace_id)
    end
  end
end