From 6777bd262987ee018f0fb20c729b1f67efb3d1c6 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Sat, 16 Jul 2016 15:11:34 +1000 Subject: [PATCH] warm up v8 after fork --- config/unicorn.conf.rb | 4 ++++ lib/discourse.rb | 3 +++ 2 files changed, 7 insertions(+) diff --git a/config/unicorn.conf.rb b/config/unicorn.conf.rb index 1e3752218d..b364b45e9e 100644 --- a/config/unicorn.conf.rb +++ b/config/unicorn.conf.rb @@ -164,5 +164,9 @@ before_fork do |server, worker| end after_fork do |server, worker| + # warm up v8 after fork, that way we do not fork a v8 context + # it may cause issues if bg threads in a v8 isolate randomly stop + # working due to fork Discourse.after_fork + PrettyText.cook("warm up **pretty text**") end diff --git a/lib/discourse.rb b/lib/discourse.rb index eff8f9aca1..fc9b737700 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -321,6 +321,9 @@ module Discourse # re-establish Sidekiq.redis = sidekiq_redis_config start_connection_reaper + + # in case v8 was initialized we want to make sure it is nil + PrettyText.reset_context nil end