summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-07-09 15:59:00 +0900
committerShinya Maeda <shinya@gitlab.com>2018-11-19 14:33:19 +0900
commitc534c3f1b0fe3bd81ed3d7204d86bd13add52355 (patch)
treea55a0b4f32612f6ac0c9694f2b9cd61a56667aa9
parente20ceb56dea2b48c3b419d99417be367abe38742 (diff)
downloadgitlab-ce-c534c3f1b0fe3bd81ed3d7204d86bd13add52355.tar.gz
Caching a file always when use file
-rw-r--r--app/uploaders/object_storage.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb
index dad6e85fb56..f80f0d378d7 100644
--- a/app/uploaders/object_storage.rb
+++ b/app/uploaders/object_storage.rb
@@ -245,8 +245,12 @@ module ObjectStorage
end
def use_file(&blk)
- with_exclusive_lease do
- unsafe_use_file(&blk)
+ begin
+ cache_stored_file!
+ yield cache_path
+ ensure
+ FileUtils.rm_f(cache_path)
+ cache_storage.delete_dir!(cache_path(nil))
end
end
@@ -441,18 +445,4 @@ module ObjectStorage
raise e
end
end
-
- def unsafe_use_file
- if file_storage?
- return yield path
- end
-
- begin
- cache_stored_file!
- yield cache_path
- ensure
- FileUtils.rm_f(cache_path)
- cache_storage.delete_dir!(cache_path(nil))
- end
- end
end