diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 19:42:21 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 19:42:21 -0800 |
commit | 1efec8d12b9cab3b706741dd2cd233d702ca4476 (patch) | |
tree | 4903e0a99fe146bd333e5e5edd6d714f5b818e62 | |
parent | Working index status check! (diff) | |
download | backend-1efec8d12b9cab3b706741dd2cd233d702ca4476.tar.gz backend-1efec8d12b9cab3b706741dd2cd233d702ca4476.tar.bz2 backend-1efec8d12b9cab3b706741dd2cd233d702ca4476.zip |
Cleanup check.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | lib/storage.rb | 6 |
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 |