diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-30 15:43:26 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-30 15:43:26 +0300 |
commit | bbcdad188cdfbfda1c11b46ee1858e04496dd47f (patch) | |
tree | 085097fcccea0f11cc35b6aaf49a25a7efc4bd1d /app | |
parent | bdd595c40de4ff9adc79bed54b1dca46ca4491fc (diff) | |
parent | a23ef89e576125740bd33aa64e434c38454790fc (diff) |
Merge branch '46917-gitlab-is-not-sending-objectstore-timeout-value-to-workhorse' into 'master'
Resolve "gitlab is not sending ObjectStore timeout value to workhorse"
Closes #46917
See merge request gitlab-org/gitlab-ce!19201
Diffstat (limited to 'app')
-rw-r--r-- | app/uploaders/object_storage.rb | 4 |
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) |