summaryrefslogtreecommitdiff
path: root/lib/backup/repository.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-25 18:10:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-25 18:10:49 +0000
commit2b349d9a94f00320a82e24be96ee8aeda9135702 (patch)
treebf5531e0c78cf0f55c74e2e8651b5a2a7418f9a2 /lib/backup/repository.rb
parent11a29f1f026ecd0c466625782af00a14889a2f91 (diff)
downloadgitlab-ce-2b349d9a94f00320a82e24be96ee8aeda9135702.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/backup/repository.rb')
-rw-r--r--lib/backup/repository.rb38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 1daa29f00ef..33fa36e6497 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -26,13 +26,17 @@ module Backup
threads = Gitlab.config.repositories.storages.keys.map do |storage|
Thread.new do
- dump_storage(storage, semaphore, max_storage_concurrency: max_storage_concurrency)
- rescue => e
- errors << e
+ Rails.application.executor.wrap do
+ dump_storage(storage, semaphore, max_storage_concurrency: max_storage_concurrency)
+ rescue => e
+ errors << e
+ end
end
end
- threads.each(&:join)
+ ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
+ threads.each(&:join)
+ end
raise errors.pop unless errors.empty?
end
@@ -155,16 +159,18 @@ module Backup
threads = Array.new(max_storage_concurrency) do
Thread.new do
- while project = queue.pop
- semaphore.acquire
-
- begin
- dump_project(project)
- rescue => e
- errors << e
- break
- ensure
- semaphore.release
+ Rails.application.executor.wrap do
+ while project = queue.pop
+ semaphore.acquire
+
+ begin
+ dump_project(project)
+ rescue => e
+ errors << e
+ break
+ ensure
+ semaphore.release
+ end
end
end
end
@@ -177,7 +183,9 @@ module Backup
end
queue.close
- threads.each(&:join)
+ ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
+ threads.each(&:join)
+ end
raise errors.pop unless errors.empty?
end