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
317a6ada
Commit
317a6ada
authored
Apr 06, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set DEFAULT_OBJECT_TYPES as a list of strings to avoid casting
parent
afbaeb8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
app/services/geo/file_download_service.rb
app/services/geo/file_download_service.rb
+5
-5
app/services/geo/file_upload_service.rb
app/services/geo/file_upload_service.rb
+4
-4
No files found.
app/services/geo/file_download_service.rb
View file @
317a6ada
...
...
@@ -3,10 +3,10 @@ module Geo
attr_reader
:object_type
,
:object_db_id
LEASE_TIMEOUT
=
8
.
hours
.
freeze
DEFAULT_OBJECT_TYPES
=
[
:attachment
,
:avatar
,
:
file
].
freeze
DEFAULT_OBJECT_TYPES
=
%w[attachment avatar
file]
.
freeze
def
initialize
(
object_type
,
object_db_id
)
@object_type
=
object_type
@object_type
=
object_type
.
to_s
@object_db_id
=
object_db_id
end
...
...
@@ -30,13 +30,13 @@ module Geo
def
downloader_klass_name
klass_name
=
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
.
to_sym
)
:file
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
)
'file'
else
object_type
end
"Gitlab::Geo::
#{
klass_name
.
to_s
.
camelize
}
Downloader"
"Gitlab::Geo::
#{
klass_name
.
camelize
}
Downloader"
end
def
try_obtain_lease
...
...
app/services/geo/file_upload_service.rb
View file @
317a6ada
module
Geo
class
FileUploadService
DEFAULT_OBJECT_TYPES
=
[
:attachment
,
:avatar
,
:
file
].
freeze
DEFAULT_OBJECT_TYPES
=
%w[attachment avatar
file]
.
freeze
IAT_LEEWAY
=
60
.
seconds
.
to_i
attr_reader
:object_type
,
:object_db_id
,
:auth_header
...
...
@@ -30,13 +30,13 @@ module Geo
def
uploader_klass_name
klass_name
=
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
.
to_sym
)
:file
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
)
'file'
else
object_type
end
"Gitlab::Geo::
#{
klass_name
.
to_s
.
camelize
}
Uploader"
"Gitlab::Geo::
#{
klass_name
.
camelize
}
Uploader"
end
def
log
(
message
)
...
...
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