Skip to content

Ensure StatisticsRefresherService acts on root namespace

Vijay Hawoldar requested to merge vij-refresh-root-namespace into master

What does this MR do and why?

The Namespaces::StatisticsRefresherService handles creating and/or updating the RootStorageStatistics relation for a given namespace.

Before this MR, that would be the case for whichever namespace is provided to the service, but, only a top level (root) namespace should have the root statistics related record.

With this MR, the service is adjusted to look up the root ancestor for the given namespace, which means it we can pass any namespace to the service and be confident that the statistics will only be created/recalculated for the root level namespace.

How to set up and validate locally

  1. Create a sub-group
  2. Confirm no statistics are present
    > sub_group.root_storage_statistics
    => nil
  3. Use the service with the sub group
    Namespaces::StatisticsRefresherService.new.execute(sub_group)
  4. Confirm there are still no statistics present for the sub group
    > sub_group.reload.root_storage_statistics
    => nil

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading