From 56c408b7b2040de62aa4487ef7b5457b3d217fc6 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 19 Aug 2024 17:39:56 -0700 Subject: [PATCH] Don't hang up the whole status page if the NFS check hangs? --- config/initializers/okcomputer.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)