Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ea81c276
Commit
ea81c276
authored
Mar 08, 2018
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Submit a single batch blob RPC to Gitaly per HTTP request when viewing diffs
parent
cb5cc14d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
changelogs/unreleased/osw-43951-single-batch-blob-request-to-gitaly.yml
...eleased/osw-43951-single-batch-blob-request-to-gitaly.yml
+5
-0
lib/gitlab/diff/file_collection/merge_request_diff.rb
lib/gitlab/diff/file_collection/merge_request_diff.rb
+10
-8
No files found.
changelogs/unreleased/osw-43951-single-batch-blob-request-to-gitaly.yml
0 → 100644
View file @
ea81c276
---
title
:
Submit a single batch blob RPC to Gitaly per HTTP request when viewing diffs
merge_request
:
author
:
type
:
performance
lib/gitlab/diff/file_collection/merge_request_diff.rb
View file @
ea81c276
...
@@ -13,7 +13,16 @@ module Gitlab
...
@@ -13,7 +13,16 @@ module Gitlab
end
end
def
diff_files
def
diff_files
super
.
tap
{
|
_
|
store_highlight_cache
}
# Make sure to _not_ send any method call to Gitlab::Diff::File
# _before_ all of them were collected (`super`). Premature method calls will
# trigger N+1 RPCs to Gitaly through BatchLoader records (Blob.lazy).
#
diff_files
=
super
diff_files
.
each
{
|
diff_file
|
cache_highlight!
(
diff_file
)
if
cacheable?
(
diff_file
)
}
store_highlight_cache
diff_files
end
end
def
real_size
def
real_size
...
@@ -22,13 +31,6 @@ module Gitlab
...
@@ -22,13 +31,6 @@ module Gitlab
private
private
# 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?
(
diff_file
)
diff_file
end
def
highlight_diff_file_from_cache!
(
diff_file
,
cache_diff_lines
)
def
highlight_diff_file_from_cache!
(
diff_file
,
cache_diff_lines
)
diff_file
.
highlighted_diff_lines
=
cache_diff_lines
.
map
do
|
line
|
diff_file
.
highlighted_diff_lines
=
cache_diff_lines
.
map
do
|
line
|
Gitlab
::
Diff
::
Line
.
init_from_hash
(
line
)
Gitlab
::
Diff
::
Line
.
init_from_hash
(
line
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment