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
b1664a69
Commit
b1664a69
authored
Oct 13, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Properly check return value of file download return codes
Closes #3749
parent
bd7ba308
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
app/services/geo/file_download_service.rb
app/services/geo/file_download_service.rb
+1
-1
spec/services/geo/file_download_service_spec.rb
spec/services/geo/file_download_service_spec.rb
+6
-0
spec/workers/geo/file_download_dispatch_worker_spec.rb
spec/workers/geo/file_download_dispatch_worker_spec.rb
+1
-0
No files found.
app/services/geo/file_download_service.rb
View file @
b1664a69
...
...
@@ -6,7 +6,7 @@ module Geo
try_obtain_lease
do
|
lease
|
start_time
=
Time
.
now
bytes_downloaded
=
downloader
.
execute
success
=
bytes_downloaded
&&
bytes_downloaded
>=
0
success
=
(
bytes_downloaded
.
present?
&&
bytes_downloaded
>=
0
)
log_info
(
"File download"
,
success:
success
,
bytes_downloaded:
bytes_downloaded
,
...
...
spec/services/geo/file_download_service_spec.rb
View file @
b1664a69
...
...
@@ -30,6 +30,12 @@ describe Geo::FileDownloadService do
expect
{
execute!
}.
to
change
{
Geo
::
FileRegistry
.
failed
.
count
}.
by
(
1
)
end
it
'registers when the download fails with some other error'
do
stub_transfer
(
Gitlab
::
Geo
::
FileTransfer
,
nil
)
expect
{
execute!
}.
to
change
{
Geo
::
FileRegistry
.
failed
.
count
}.
by
(
1
)
end
end
context
'group avatar'
do
...
...
spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
b1664a69
...
...
@@ -62,6 +62,7 @@ describe Geo::FileDownloadDispatchWorker, :postgresql do
it
'attempts to load a new batch without pending downloads'
do
stub_const
(
'Geo::BaseSchedulerWorker::DB_RETRIEVE_BATCH_SIZE'
,
5
)
stub_const
(
'Geo::BaseSchedulerWorker::MAX_CAPACITY'
,
2
)
allow_any_instance_of
(
::
Gitlab
::
Geo
::
Transfer
).
to
receive
(
:download_from_primary
).
and_return
(
100
)
avatar
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
create_list
(
:lfs_object
,
2
,
:with_file
)
...
...
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