Commit 3c5586c2 authored by Ismael Posada Trobo's avatar Ismael Posada Trobo
Browse files

DEV: Improve bin/unicorn boot time in development environment...

DEV: Improve bin/unicorn boot time in development environment (https://github.com/discourse/discourse/commit/cac7725e28eea5bd27d4e4452d3d654edbe6c397)
parent a6305422
...@@ -249,18 +249,19 @@ before_fork do |server, worker| ...@@ -249,18 +249,19 @@ before_fork do |server, worker|
# to the implementation of standard Unix signal handlers, this # to the implementation of standard Unix signal handlers, this
# helps (but does not completely) prevent identical, repeated signals # helps (but does not completely) prevent identical, repeated signals
# from being lost when the receiving process is busy. # from being lost when the receiving process is busy.
sleep 1 sleep 1 if !Rails.env.development?
end end
after_fork do |server, worker| after_fork do |server, worker|
DiscourseEvent.trigger(:web_fork_started) DiscourseEvent.trigger(:web_fork_started)
Discourse.after_fork
# warm up v8 after fork, that way we do not fork a v8 context # 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 # it may cause issues if bg threads in a v8 isolate randomly stop
# working due to fork # working due to fork
Discourse.after_fork
begin begin
PrettyText.cook("warm up **pretty text**") # Skip warmup in development mode - it makes boot take ~2s longer
PrettyText.cook("warm up **pretty text**") if !Rails.env.development?
rescue => e rescue => e
Rails.logger.error("Failed to warm up pretty text: #{e}") Rails.logger.error("Failed to warm up pretty text: #{e}")
end end
......
Supports Markdown
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