diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-04 00:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-04 00:09:17 +0300 |
commit | a1ed241c8212fe848501de9d561796ed6879307f (patch) | |
tree | f4cd88555f3e9be61e498761c7a289260135c806 /app/services/pages | |
parent | 174343966742d2f4b87ac84f9ce4ee576cb9d75e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/pages')
-rw-r--r-- | app/services/pages/migrate_from_legacy_storage_service.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/services/pages/migrate_from_legacy_storage_service.rb b/app/services/pages/migrate_from_legacy_storage_service.rb index 64b6a43436b..d805ae2418c 100644 --- a/app/services/pages/migrate_from_legacy_storage_service.rb +++ b/app/services/pages/migrate_from_legacy_storage_service.rb @@ -24,9 +24,7 @@ module Pages @queue.close @logger.info("Waiting for threads to finish...") - ActiveSupport::Dependencies.interlock.permit_concurrent_loads do - threads.each(&:join) - end + threads.each(&:join) { migrated: @migrated, errored: @errored } end @@ -34,8 +32,8 @@ module Pages def start_migration_threads Array.new(@migration_threads) do Thread.new do - Rails.application.executor.wrap do - while batch = @queue.pop + while batch = @queue.pop + Rails.application.executor.wrap do process_batch(batch) end end @@ -51,6 +49,11 @@ module Pages end @logger.info("#{@migrated} projects are migrated successfully, #{@errored} projects failed to be migrated") + rescue => e + # This method should never raise exception otherwise all threads might be killed + # and this will result in queue starving (and deadlock) + Gitlab::ErrorTracking.track_exception(e) + @logger.error("failed processing a batch: #{e.message}") end def migrate_project(project) |