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.
This commit is contained in:
David Taylor 2022-05-23 14:26:13 +01:00 committed by GitHub
parent eef17318c3
commit 115fe90bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -124,8 +124,10 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
exceptions = Queue.new
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
if concurrency > 1
$stdout = old_stdout
end
check_exceptions(exceptions)
Rake::Task['db:_dump'].invoke