diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-07-09 15:59:00 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-11-19 14:33:19 +0900 |
commit | c534c3f1b0fe3bd81ed3d7204d86bd13add52355 (patch) | |
tree | a55a0b4f32612f6ac0c9694f2b9cd61a56667aa9 | |
parent | e20ceb56dea2b48c3b419d99417be367abe38742 (diff) | |
download | gitlab-ce-c534c3f1b0fe3bd81ed3d7204d86bd13add52355.tar.gz |
Caching a file always when use file
-rw-r--r-- | app/uploaders/object_storage.rb | 22 |
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 |