Skip to content

Commit

Permalink
Merge pull request #138 from airbnb/fix_ruby_2_x_support
Browse files Browse the repository at this point in the history
Do not unregister the callback in the zk watcher
  • Loading branch information
jolynch committed Sep 7, 2015
2 parents 6795c4e + dd98363 commit 6970f1a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/synapse/service_watcher/zookeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ 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)
log.error "synapse: zookeeper watcher path #{@discovery['path']} does not exist!"
raise RuntimeError.new('could not set a ZK watch on a node that should exist')
zk_cleanup
end
log.debug "synapse: set watch at #{@discovery['path']}"
end
Expand Down

0 comments on commit 6970f1a

Please sign in to comment.