diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-03-21 10:03:50 +1100 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-04-19 18:35:40 +1000 |
commit | 03b020f2e4a4e48dc4ddceb1656b84aaa7938149 (patch) | |
tree | 41ec5d9630fa774c043d366b037ba35c5a9a7ab2 /app/uploaders | |
parent | 947ed8b88281a618530ae30bc0fe1e3d61a3c1d9 (diff) | |
download | gitlab-ce-03b020f2e4a4e48dc4ddceb1656b84aaa7938149.tar.gz |
Update ProjectStatistics#build_artifacts_size synchronously without summing (#41059)
Previously we scheduled a worker to just some this but we were running
into performance issues when the build table was getting too large. So
now we've updated the code such that this column is updated immediately
and incremented/decremented by the correct amount whenever artifacts are
created or deleted.
We've also added the performance optimization that we do not update this
statistic if a project is deleted because it could result in many
updates for a project with many builds.
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/job_artifact_uploader.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb index dd86753479d..2a5a830ce4f 100644 --- a/app/uploaders/job_artifact_uploader.rb +++ b/app/uploaders/job_artifact_uploader.rb @@ -6,10 +6,10 @@ class JobArtifactUploader < GitlabUploader storage_options Gitlab.config.artifacts - def size - return super if model.size.nil? + def cached_size + return model.size if model.size.present? && !model.file_changed? - model.size + size end def store_dir @@ -20,7 +20,7 @@ class JobArtifactUploader < GitlabUploader if file_storage? File.open(path, "rb") if path else - ::Gitlab::Ci::Trace::HttpIO.new(url, size) if url + ::Gitlab::Ci::Trace::HttpIO.new(url, cached_size) if url end end |