mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
PERF: Preload LetterAvatar.image_magick_version
in master process.
It is wasteful to run the clean up and command to generate the version digest on every unicorn child process.
This commit is contained in:
@ -935,16 +935,25 @@ module Discourse
|
|||||||
Search.prepare_data("test")
|
Search.prepare_data("test")
|
||||||
end
|
end
|
||||||
|
|
||||||
# router warm up
|
[
|
||||||
Rails.application.routes.recognize_path('abc') rescue nil
|
Thread.new {
|
||||||
|
# router warm up
|
||||||
# preload discourse version
|
Rails.application.routes.recognize_path('abc') rescue nil
|
||||||
Discourse.git_version
|
},
|
||||||
Discourse.git_branch
|
Thread.new {
|
||||||
Discourse.full_version
|
# preload discourse version
|
||||||
|
Discourse.git_version
|
||||||
require 'actionview_precompiler'
|
Discourse.git_branch
|
||||||
ActionviewPrecompiler.precompile
|
Discourse.full_version
|
||||||
|
},
|
||||||
|
Thread.new {
|
||||||
|
require 'actionview_precompiler'
|
||||||
|
ActionviewPrecompiler.precompile
|
||||||
|
},
|
||||||
|
Thread.new {
|
||||||
|
LetterAvatar.image_magick_version
|
||||||
|
}
|
||||||
|
].each(&:join)
|
||||||
ensure
|
ensure
|
||||||
@preloaded_rails = true
|
@preloaded_rails = true
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user