summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-12-28 21:55:34 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-12-28 21:55:34 +0800
commite202fe8c760d8e63a26cbac116dc94d5039fb207 (patch)
tree50ee353151ed4d586f0e3f9d588795b33b6b59b3
parent1f16d214db6e688ac2c6e0731eb183f08f916a0d (diff)
downloadgitlab-ce-38930-warmup.tar.gz
Warm up the app so it's fast for the 1st request38930-warmup
This would make the application considered ready much slower, but when it's ready, then it's really ready. Before this change, it claims to be ready, but it's annoyingly slow for the first request with GDK. It's 100% 502 for me, for the first request. This shouldn't really affect production or so, because if it's really ready, it should be blazingly fast, and it should not slow things down too much. The culprit here is probably `ActionController::Base.helpers.asset_path` but this could make sure that anything else would load first, too.
-rw-r--r--config.ru5
1 files changed, 5 insertions, 0 deletions
diff --git a/config.ru b/config.ru
index 065ce59932f..de0400f4f67 100644
--- a/config.ru
+++ b/config.ru
@@ -17,6 +17,11 @@ end
require ::File.expand_path('../config/environment', __FILE__)
+warmup do |app|
+ client = Rack::MockRequest.new(app)
+ client.get('/')
+end
+
map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
run Gitlab::Application
end