diff options
author | Markus Koller <markus-koller@gmx.ch> | 2016-11-22 17:58:10 +0100 |
---|---|---|
committer | Markus Koller <markus-koller@gmx.ch> | 2016-12-21 16:39:49 +0100 |
commit | 3ef4f74b1acc9399db320b53dffc592542de0126 (patch) | |
tree | edc99011c4ed64ec50e457d3e59c1149fbb3a5ce /app/models/lfs_objects_project.rb | |
parent | 6fd58ee48dcfbca49c609c45004d6c25035af2eb (diff) | |
download | gitlab-ce-3ef4f74b1acc9399db320b53dffc592542de0126.tar.gz |
Add more storage statistics
This adds counters for build artifacts and LFS objects, and moves
the preexisting repository_size and commit_count from the projects
table into a new project_statistics table.
The counters are displayed in the administration area for projects
and groups, and also available through the API for admins (on */all)
and normal users (on */owned)
The statistics are updated through ProjectCacheWorker, which can now
do more granular updates with the new :statistics argument.
Diffstat (limited to 'app/models/lfs_objects_project.rb')
-rw-r--r-- | app/models/lfs_objects_project.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/lfs_objects_project.rb b/app/models/lfs_objects_project.rb index 0fd5f089db9..007eed5600a 100644 --- a/app/models/lfs_objects_project.rb +++ b/app/models/lfs_objects_project.rb @@ -5,4 +5,13 @@ class LfsObjectsProject < ActiveRecord::Base validates :lfs_object_id, presence: true validates :lfs_object_id, uniqueness: { scope: [:project_id], message: "already exists in project" } validates :project_id, presence: true + + after_create :update_project_statistics + after_destroy :update_project_statistics + + private + + def update_project_statistics + ProjectCacheWorker.perform_async(project_id, [], [:lfs_objects_size]) + end end |