Skip to content

Commit

Permalink
Do not unregister the callback in the zk watcher
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Joseph Lynch committed Sep 3, 2015
1 parent 840b080 commit 844e1a9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/synapse/service_watcher/zookeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 844e1a9

Please sign in to comment.