From 350972bae34f7300e80d56f6bbc255fcae508901 Mon Sep 17 00:00:00 2001 From: Hagen Rother Date: Fri, 5 Apr 2013 16:14:41 +0200 Subject: [PATCH] Handle expired zookeeper sessions gracefully --- lib/druid/zoo_handler.rb | 8 ++++++++ ruby-druid.gemspec | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/druid/zoo_handler.rb b/lib/druid/zoo_handler.rb index 2116cd0..7d85402 100644 --- a/lib/druid/zoo_handler.rb +++ b/lib/druid/zoo_handler.rb @@ -11,6 +11,14 @@ def initialize(uri, opts = {}) @discovery_path = opts[:discovery_path] || '/discoveryPath' @watched_services = Hash.new + init_zookeeper + end + + def init_zookeeper + @zk.on_expired_session do + init_zookeeper + end + @zk.register(@discovery_path, :only => :child) do |event| check_services end diff --git a/ruby-druid.gemspec b/ruby-druid.gemspec index cd91a9e..aae2a82 100644 --- a/ruby-druid.gemspec +++ b/ruby-druid.gemspec @@ -2,7 +2,7 @@ require 'rake' Gem::Specification.new do |gem| gem.name = 'ruby-druid' - gem.version = '0.0.5' + gem.version = '0.0.6' gem.date = '2013-04-04' gem.summary = 'Ruby client for druid' gem.description = 'Ruby client for metamx druid'