commit:     d83a8a9a7ab8e204ef5ba0161a6424e854a28a93
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 02:52:49 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Feb 24 02:52:49 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=d83a8a9a

Improve poll code.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 lib/storage.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index bf90202..fa1fa51 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -11,8 +11,9 @@ module Ag::Storage
   end
 
   def create_index(list)
+    indexname = 'ml-' + list
     $es.indices.create(
-      index: 'ml-' + list,
+      index: indexname,
       body: {
         mappings: {
           message: {
@@ -87,9 +88,12 @@ module Ag::Storage
       })
 
     # Give elasticsearch some time to process the new index
+    puts $es.cluster.health
+    puts $es.indices.status(index: indexname)
     while $es.cluster.health['status'] != 'green' do
-        sleep 0.05
         puts $es.cluster.health
+               puts $es.indices.status(index: indexname)
+        sleep 0.05
     end
   end
 

Reply via email to