aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/storage.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/storage.rb b/lib/storage.rb
index 4135971..fe50ea8 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -6,13 +6,13 @@ module Ag::Storage
module_function
def index_status(indexname)
- $es.cluster.health(level: :indices)['indices'][indexname]['status']
+ $es.cluster.health(level: :indices)['indices'][indexname]['status'] || 'FAIL'
end
def index_ready?(indexname)
- status = index_status(indexname)
+ # watch out if you rewrite this
# if you call index_status twice, you might get different results!
- return status == 'green' or status == 'yellow'
+ [:green, :yellow].include? index_status(indexname).downcase.to_sym
end
# Throws Elasticsearch::Transport::Transport::Errors::NotFound