diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cc7746e56..15a8cc99f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -21,9 +21,12 @@ class ApplicationController < ActionController::Base
class AccessDenied < StandardError; end
rescue_from AccessDenied, with: :on_access_denied
+
rescue_from Async::Stop, Async::Container::Terminate,
with: :on_request_stopped
+ rescue_from ActiveRecord::ConnectionTimeoutError, with: :on_db_timeout
+
def authenticate_user!
redirect_to(new_auth_user_session_path) unless user_signed_in?
end
@@ -65,6 +68,11 @@ class ApplicationController < ActionController::Base
status: :internal_server_error
end
+ def on_db_timeout
+ render file: 'public/503.html', layout: false,
+ status: :service_unavailable
+ end
+
def redirect_back!(default=:back)
redirect_to(params[:return_to] || default)
end
diff --git a/public/503.html b/public/503.html
new file mode 100644
index 000000000..ac4991997
--- /dev/null
+++ b/public/503.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+ Dress to Impress: Whelmy mode!
+
+
+
+
+
+
+
DTI is overloaded!
+
+ There's a lot going on in our server right now… usually this lasts for
+ a few seconds, then passes? Sorry about this!
+
+
+ If this keeps happening, we'll be alerted automatically, and we'll do
+ our best to get it fixed up 💖
+
+
+
+
+