diff --git a/README.md b/README.md index da2720e..3ece999 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,4 @@ * [x] LXD aware (through remote ssh) * [x] Rufo Formatter * [x] Semantic Logging (efficient for dark theme) +* [x] Max duration to complete in order to prevent long action diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dfd83fa..83d4bf7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,8 @@ class ApplicationController < ActionController::Base + MAX_DURATION_TO_COMPLETE_IN_SECONDS = 3 + around_action do |_, action| - logger.measure_error "Took too long to complete, please review your code as asynchronous task", min_duration: 3000 do + logger.measure_error "Took too long to complete, please review your code as asynchronous task", min_duration: MAX_DURATION_TO_COMPLETE_IN_SECONDS * 1000 do action.call end end diff --git a/app/views/main/about.html.erb b/app/views/main/about.html.erb index 307813b..cd51748 100644 --- a/app/views/main/about.html.erb +++ b/app/views/main/about.html.erb @@ -1,2 +1,2 @@
Find me in app/views/main/about.html.erb
+This page takes a while to complete