Ensure StatisticsRefresherService acts on root namespace
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
- Create a sub-group
- Confirm no statistics are present
> sub_group.root_storage_statistics => nil
- Use the service with the sub group
Namespaces::StatisticsRefresherService.new.execute(sub_group)
- 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.
-
I have evaluated the MR acceptance checklist for this MR.