Pass object type to the file downloader

parent eaf0a841
......@@ -21,9 +21,9 @@ module Geo
def downloader
klass = "Gitlab::Geo::#{object_type.to_s.camelize}Downloader".constantize
klass.new(object_db_id)
klass.new(object_type, object_db_id)
rescue NameError
Gitlab::Geo::FileDownloader.new(object_db_id)
Gitlab::Geo::FileDownloader.new(object_type, object_db_id)
end
def try_obtain_lease
......
module Gitlab
module Geo
class FileDownloader
attr_reader :object_db_id
attr_reader :object_type, :object_db_id
def initialize(object_db_id)
def initialize(object_type, object_db_id)
@object_type = object_type
@object_db_id = object_db_id
end
......@@ -15,7 +16,7 @@ module Gitlab
upload = Upload.find_by_id(object_db_id)
return unless upload.present?
transfer = ::Gitlab::Geo::FileTransfer.new(:avatar, upload)
transfer = ::Gitlab::Geo::FileTransfer.new(object_type.to_sym, upload)
transfer.download_from_primary
end
end
......
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