diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cc7746e5..15a8cc99 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 00000000..ac499199 --- /dev/null +++ b/public/503.html @@ -0,0 +1,59 @@ + + + + + + Dress to Impress: Whelmy mode! + + + +
+ Distressed Grundo programmer +
+

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 💖 +

+
+
+ +