Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove on_connected to avoid reconnect storm #294

Merged
merged 1 commit into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
synapse (0.16.9)
synapse (0.16.10)
aws-sdk (~> 1.39)
docker-api (~> 1.7)
dogstatsd-ruby (~> 3.3.0)
Expand Down
13 changes: 0 additions & 13 deletions lib/synapse/service_watcher/zookeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,19 +359,6 @@ def zk_connect
zk_cleanup
end

# handle session connected after reconnecting
# http://zookeeper.apache.org/doc/r3.3.5/zookeeperProgrammers.html#ch_zkSessions
@zk.on_connected do
log.info "synapse: ZK client has reconnected #{@name}"
# random backoff to avoid refresh at the same time
sleep rand(10)
# zookeeper watcher is one-time trigger, and can be lost when disconnected
# https://zookeeper.apache.org/doc/r3.3.5/zookeeperProgrammers.html#ch_zkWatches
@watcher.unsubscribe unless @watcher.nil?
@watcher = nil
watcher_callback.call
end

# the path must exist, otherwise watch callbacks will not work
statsd_time('synapse.watcher.zk.create_path.elapsed_time', ["zk_cluster:#{@zk_cluster}", "service_name:#{@name}"]) do
create(@discovery['path'])
Expand Down
2 changes: 1 addition & 1 deletion lib/synapse/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Synapse
VERSION = "0.16.9"
VERSION = "0.16.10"
end