diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index aa9c92e1..3f588f84 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -14,6 +14,20 @@ OkComputer::Registry.register 'rails_cache', OkComputer::GenericCacheCheck.new +class DirectoryCheckWithTimeout < OkComputer::DirectoryCheck + def check + Timeout.timeout(5) do + super + end + rescue Timeout::Error + mark_failure + mark_message "Timed out after 5 seconds" + end +end + +OkComputer::Registry.register 'stacks_root_dir', + DirectoryCheckWithTimeout.new(Settings.stacks.storage_root) + OkComputer::Registry.register 'stacks_mounted_dir', OkComputer::DirectoryCheck.new(Settings.stacks.storage_root)