From 115fe90bff3b205074448fbc699de41d9ef28615 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 23 May 2022 14:26:13 +0100 Subject: [PATCH] DEV: Only demux migration stdout if running concurrently (#16895) This feature only was only demuxing stdout, not stderr. That means that stdout and stderr output appears out-of-order, and makes debugging migrations very confusing. In future we may want to add stderr support to the demuxing. But right now, the concurrency variable is hard-coded to 1. Therefore the easiest fix is to bypass the demuxing. --- lib/tasks/db.rake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index dcdf90664f2..6ec234a0fef 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -124,8 +124,10 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do | exceptions = Queue.new - old_stdout = $stdout - $stdout = StdOutDemux.new($stdout) + if concurrency > 1 + old_stdout = $stdout + $stdout = StdOutDemux.new($stdout) + end SeedFu.quiet = true @@ -151,7 +153,7 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do | exceptions << [db, e] ensure begin - $stdout.finish_chunk + $stdout.finish_chunk if concurrency > 1 rescue => ex STDERR.puts ex.inspect STDERR.puts ex.backtrace @@ -198,7 +200,9 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do | end end - $stdout = old_stdout + if concurrency > 1 + $stdout = old_stdout + end check_exceptions(exceptions) Rake::Task['db:_dump'].invoke