Class: Namespaces::StatisticsRefresherService

Inherits:
Object
  • Object
show all
Defined in:
app/services/namespaces/statistics_refresher_service.rb

Constant Summary collapse

RefresherError =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#execute(root_namespace) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/services/namespaces/statistics_refresher_service.rb', line 7

def execute(root_namespace)
  root_namespace = root_namespace.root_ancestor # just in case the true root isn't passed
  root_storage_statistics = find_or_create_root_storage_statistics(root_namespace.id)

  root_storage_statistics.recalculate!
rescue ActiveRecord::ActiveRecordError => e
  raise RefresherError, e.message
end