summaryrefslogtreecommitdiff
path: root/app/uploaders/object_storage.rb
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-05-29 15:08:16 +0200
committerAlessio Caiazza <acaiazza@gitlab.com>2018-05-29 19:01:05 +0200
commita23ef89e576125740bd33aa64e434c38454790fc (patch)
tree514d775e9c4fa69e18627f3ad3b757d1c3891fc8 /app/uploaders/object_storage.rb
parent4c74936f4567ba142bcd9ca31c8f5f10c8aa52fa (diff)
downloadgitlab-ce-a23ef89e576125740bd33aa64e434c38454790fc.tar.gz
Fix missing timeout value in object storage pre-authorization call
Diffstat (limited to 'app/uploaders/object_storage.rb')
-rw-r--r--app/uploaders/object_storage.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb
index 3fd27d9acdc..5bdca26a584 100644
--- a/app/uploaders/object_storage.rb
+++ b/app/uploaders/object_storage.rb
@@ -11,6 +11,7 @@ module ObjectStorage
ObjectStorageUnavailable = Class.new(StandardError)
DIRECT_UPLOAD_TIMEOUT = 4.hours
+ DIRECT_UPLOAD_EXPIRE_OFFSET = 15.minutes
TMP_UPLOAD_PATH = 'tmp/uploads'.freeze
module Store
@@ -174,11 +175,12 @@ module ObjectStorage
id = [CarrierWave.generate_cache_id, SecureRandom.hex].join('-')
upload_path = File.join(TMP_UPLOAD_PATH, id)
connection = ::Fog::Storage.new(self.object_store_credentials)
- expire_at = Time.now + DIRECT_UPLOAD_TIMEOUT
+ expire_at = Time.now + DIRECT_UPLOAD_TIMEOUT + DIRECT_UPLOAD_EXPIRE_OFFSET
options = { 'Content-Type' => 'application/octet-stream' }
{
ID: id,
+ Timeout: DIRECT_UPLOAD_TIMEOUT,
GetURL: connection.get_object_url(remote_store_path, upload_path, expire_at),
DeleteURL: connection.delete_object_url(remote_store_path, upload_path, expire_at),
StoreURL: connection.put_object_url(remote_store_path, upload_path, expire_at, options)