aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-02-23 18:52:49 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2015-02-23 18:52:49 -0800
commitd83a8a9a7ab8e204ef5ba0161a6424e854a28a93 (patch)
treedc820b5c3efd1e68deb442c15b94cedad95bf740
parentImprove sleep code. (diff)
downloadbackend-d83a8a9a7ab8e204ef5ba0161a6424e854a28a93.tar.gz
backend-d83a8a9a7ab8e204ef5ba0161a6424e854a28a93.tar.bz2
backend-d83a8a9a7ab8e204ef5ba0161a6424e854a28a93.zip
Improve poll code.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--lib/storage.rb8
1 files 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