DEV: disable async logging in development on broken Ruby

Ruby 2.5.3 has an upatched issue that crashes unicorn after fork:

https://bugs.ruby-lang.org/issues/14634

This will be patched in 2.5.4 however for now just warn people dev is slower
and disable async logging on the older rubies
This commit is contained in:
Sam 2019-02-21 17:20:42 +11:00
parent 8a3d12dd34
commit 8745f78277
2 changed files with 10 additions and 1 deletions

View File

@ -186,7 +186,7 @@ GEM
logstash-event (1.2.02)
logstash-logger (0.26.1)
logstash-event (~> 1.2)
logster (2.1.0)
logster (2.1.1)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)

View File

@ -1,3 +1,12 @@
if Rails.env.development? && RUBY_VERSION.match?(/^2\.5\.[23]/)
STDERR.puts "WARNING: Discourse development environment runs slower on Ruby 2.5.3 or below"
STDERR.puts "We recommend you upgrade to Ruby 2.6.1 for the optimal development performance"
# we have to used to older and slower version of the logger cause the new one exposes a Ruby bug in
# the Queue class which causes segmentation faults
Logster::Scheduler.disable
end
if Rails.env.development? && !Sidekiq.server? && ENV["RAILS_LOGS_STDOUT"] == "1"
console = ActiveSupport::Logger.new(STDOUT)
original_logger = Rails.logger.chained.first