summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-26 11:19:57 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-26 11:19:57 +0200
commitcb405aa45dd5acf766797a7375043b6608d394f8 (patch)
treed47da41db6f1ffdca252751cf00428c12fa0f696
parent7151fb754b82888e022bfced02f2fdfd9000a1ff (diff)
downloadgitlab-ce-cb405aa45dd5acf766797a7375043b6608d394f8.tar.gz
Refactor max_size method in update pages servicefix/gb/handle-max-pages-artifacts-size-correctly
As per review feedback https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13072#note_35853177
-rw-r--r--app/services/projects/update_pages_service.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb
index a819b799ff8..749a1cc56d8 100644
--- a/app/services/projects/update_pages_service.rb
+++ b/app/services/projects/update_pages_service.rb
@@ -130,9 +130,11 @@ module Projects
end
def max_size
- current_application_settings.max_pages_size.megabytes.tap do |maximum|
- return MAX_SIZE if maximum.zero? || maximum > MAX_SIZE
- end
+ max_pages_size = current_application_settings.max_pages_size.megabytes
+
+ return MAX_SIZE if max_pages_size.zero?
+
+ [max_pages_size, MAX_SIZE].min
end
def tmp_path