Set DEFAULT_OBJECT_TYPES as a list of strings to avoid casting

parent afbaeb8c
......@@ -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
......
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment