Commit bb68df56 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '300003-pages-migration-threads-fail-sometimes' into 'master'

Fix pages migration threads

See merge request gitlab-org/gitlab!52571
parents 15455c3f 1fef53b9
......@@ -11,5 +11,5 @@ class ProjectPagesMetadatum < ApplicationRecord
scope :deployed, -> { where(deployed: true) }
scope :only_on_legacy_storage, -> { deployed.where(pages_deployment: nil) }
scope :with_project_route_and_deployment, -> { preload(project: [:namespace, :route, pages_metadatum: :pages_deployment]) }
scope :with_project_route_and_deployment, -> { preload(:pages_deployment, project: [:namespace, :route]) }
end
......@@ -32,8 +32,10 @@ module Pages
def start_migration_threads
Array.new(@migration_threads) do
Thread.new do
while batch = @queue.pop
process_batch(batch)
Rails.application.executor.wrap do
while batch = @queue.pop
process_batch(batch)
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment