PERF: Preload `LetterAvatar.image_magick_version` in master process.

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.

diff --git a/lib/discourse.rb b/lib/discourse.rb
index a3ae1ad..6d188b9 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -935,16 +935,25 @@ module Discourse
       Search.prepare_data("test")
     end
 
-    # router warm up
-    Rails.application.routes.recognize_path('abc') rescue nil
-
-    # preload discourse version
-    Discourse.git_version
-    Discourse.git_branch
-    Discourse.full_version
-
-    require 'actionview_precompiler'
-    ActionviewPrecompiler.precompile
+    [
+      Thread.new {
+        # router warm up
+        Rails.application.routes.recognize_path('abc') rescue nil
+      },
+      Thread.new {
+        # preload discourse version
+        Discourse.git_version
+        Discourse.git_branch
+        Discourse.full_version
+      },
+      Thread.new {
+        require 'actionview_precompiler'
+        ActionviewPrecompiler.precompile
+      },
+      Thread.new {
+        LetterAvatar.image_magick_version
+      }
+    ].each(&:join)
   ensure
     @preloaded_rails = true
   end

GitHub sha: 4bad1e7e

This commit appears in #12980 which was approved by techAPJ and SamSaffron. It was merged by tgxworld.