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
b1512038
Commit
b1512038
authored
Oct 24, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds dynamic timeout to list_new_blobs Gitaly call
parent
cda6f2e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
5 deletions
+22
-5
ee/lib/ee/gitlab/checks/change_access.rb
ee/lib/ee/gitlab/checks/change_access.rb
+1
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
lib/gitlab/gitaly_client/ref_service.rb
lib/gitlab/gitaly_client/ref_service.rb
+9
-2
spec/lib/gitlab/gitaly_client/ref_service_spec.rb
spec/lib/gitlab/gitaly_client/ref_service_spec.rb
+10
-0
No files found.
ee/lib/ee/gitlab/checks/change_access.rb
View file @
b1512038
...
...
@@ -42,7 +42,7 @@ module EE
logger
.
log_timed
(
LOG_MESSAGES
[
__method__
])
do
max_file_size
=
push_rule
.
max_file_size
blobs
=
project
.
repository
.
new_blobs
(
newrev
)
blobs
=
project
.
repository
.
new_blobs
(
newrev
,
dynamic_timeout:
logger
.
time_left
)
large_blob
=
blobs
.
find
do
|
blob
|
::
Gitlab
::
Utils
.
bytes_to_megabytes
(
blob
.
size
)
>
max_file_size
...
...
lib/gitlab/git/repository.rb
View file @
b1512038
...
...
@@ -326,12 +326,12 @@ module Gitlab
end
end
def
new_blobs
(
newrev
)
def
new_blobs
(
newrev
,
dynamic_timeout:
nil
)
return
[]
if
newrev
.
blank?
||
newrev
==
::
Gitlab
::
Git
::
BLANK_SHA
strong_memoize
(
"new_blobs_
#{
newrev
}
"
)
do
wrapped_gitaly_errors
do
gitaly_ref_client
.
list_new_blobs
(
newrev
,
REV_LIST_COMMIT_LIMIT
)
gitaly_ref_client
.
list_new_blobs
(
newrev
,
REV_LIST_COMMIT_LIMIT
,
dynamic_timeout:
dynamic_timeout
)
end
end
end
...
...
lib/gitlab/gitaly_client/ref_service.rb
View file @
b1512038
...
...
@@ -82,15 +82,22 @@ module Gitlab
commits
end
def
list_new_blobs
(
newrev
,
limit
=
0
)
def
list_new_blobs
(
newrev
,
limit
=
0
,
dynamic_timeout:
nil
)
request
=
Gitaly
::
ListNewBlobsRequest
.
new
(
repository:
@gitaly_repo
,
commit_id:
newrev
,
limit:
limit
)
timeout
=
if
dynamic_timeout
[
dynamic_timeout
,
GitalyClient
.
medium_timeout
].
min
else
GitalyClient
.
medium_timeout
end
response
=
GitalyClient
.
call
(
@storage
,
:ref_service
,
:list_new_blobs
,
request
,
timeout:
GitalyClient
.
medium_
timeout
)
.
call
(
@storage
,
:ref_service
,
:list_new_blobs
,
request
,
timeout:
timeout
)
response
.
flat_map
do
|
msg
|
# Returns an Array of Gitaly::NewBlobObject objects
...
...
spec/lib/gitlab/gitaly_client/ref_service_spec.rb
View file @
b1512038
...
...
@@ -89,6 +89,16 @@ describe Gitlab::GitalyClient::RefService do
end
end
describe
'#list_new_blobs'
do
it
'raises DeadlineExceeded when timeout is too small'
do
newrev
=
'54fcc214b94e78d7a41a9a8fe6d87a5e59500e51'
expect
do
client
.
list_new_blobs
(
newrev
,
dynamic_timeout:
0.001
)
end
.
to
raise_error
(
GRPC
::
DeadlineExceeded
)
end
end
describe
'#local_branches'
do
it
'sends a find_local_branches message'
do
expect_any_instance_of
(
Gitaly
::
RefService
::
Stub
)
...
...
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