From 844e1a95eebbea2bd4359b3e1395d202da0f0d39 Mon Sep 17 00:00:00 2001 From: Joseph Lynch Date: Thu, 3 Sep 2015 10:51:32 -0700 Subject: [PATCH] Do not unregister the callback in the zk watcher Addresses incompatibility of per_callback threading in ZK, the way that synapse calls unsubscribe within the callback, and ruby 2.X really not liking joining on the current running thread. Should fix #137 #99 and possibly #94 --- lib/synapse/service_watcher/zookeeper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/synapse/service_watcher/zookeeper.rb b/lib/synapse/service_watcher/zookeeper.rb index 2f7b8025..00896181 100644 --- a/lib/synapse/service_watcher/zookeeper.rb +++ b/lib/synapse/service_watcher/zookeeper.rb @@ -84,8 +84,7 @@ def watch return if @zk.nil? log.debug "synapse: setting watch at #{@discovery['path']}" - @watcher.unsubscribe unless @watcher.nil? - @watcher = @zk.register(@discovery['path'], &watcher_callback) + @watcher = @zk.register(@discovery['path'], &watcher_callback) unless @watcher # Verify that we actually set up the watcher. unless @zk.exists?(@discovery['path'], :watch => true)