diff options
author | Valery Sizov <valery@gitlab.com> | 2016-11-23 20:18:34 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-11-25 16:25:01 +0300 |
commit | 847ada36c48107442f69338eda4c0b601ab98b48 (patch) | |
tree | 7134315c7af7cde1c842a8f8bbec097ee8f3696f /lib/gitlab/diff | |
parent | 4646d453b3211e29ec5afba2568766018caf32e0 (diff) |
Fix: Timeout creating and viewing merge request for binary file
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/file_collection/merge_request_diff.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/diff/file_collection/merge_request_diff.rb b/lib/gitlab/diff/file_collection/merge_request_diff.rb index fe7adb7bed6..26bb0bc16f5 100644 --- a/lib/gitlab/diff/file_collection/merge_request_diff.rb +++ b/lib/gitlab/diff/file_collection/merge_request_diff.rb @@ -20,7 +20,7 @@ module Gitlab # Extracted method to highlight in the same iteration to the diff_collection. def decorate_diff!(diff) diff_file = super - cache_highlight!(diff_file) if cacheable? + cache_highlight!(diff_file) if cacheable?(diff_file) diff_file end @@ -60,8 +60,8 @@ module Gitlab Rails.cache.write(cache_key, highlight_cache) if @highlight_cache_was_empty end - def cacheable? - @merge_request_diff.present? + def cacheable?(diff_file) + @merge_request_diff.present? && diff_file.blob.text? end def cache_key |