Check if namespace storage limit exceeded

We currently calculate root namespace storage statistics with a delay of 1.5h. This gets done in a background job, you can find more how this is done in the namespace storage statics case study.

It's therefore not costly to get the statistics of a namespace because they are pre-calculated. To check if a project exceeds the namespace limit we need to do the following:

  • Get the namespace of the project (group or user namespace)
  • Get the root_ancestor of the namespace
  • Get the NamespaceStorageStatistics of that root_namespace.
  • Get the namespace_storage_size_limit from ApplicationSettings
  • Compare the namespace_storage_size_limit with storage_statics.storage_size data

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/209119

Edited Apr 06, 2020 by Nicolas Dular
Assignee Loading
Time tracking Loading