airbnb / synapse

A transparent service discovery framework for connecting an SOA
MIT License
2.07k stars 251 forks source link

Avoid discovery_jitter sleep on first event #293

Closed Ramyak closed 5 years ago

Ramyak commented 5 years ago

If we get an event, do not sleep (discovery_jitter seconds)

Previous discovery

I, [2019-06-14T01:17:54.553668 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 3 backends for service sssp-test
I, [2019-06-14T01:17:54.579559 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 3 backends for service sssp-test-regional
I, [2019-06-14T01:17:54.592510 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 3 backends for service sssp-test-local-az

15 seconds no activity. Then discovery without sleep

I, [2019-06-14T01:18:30.594380 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 2 backends for service sssp-test-regional
I, [2019-06-14T01:18:30.595322 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 2 backends for service sssp-test
I, [2019-06-14T01:18:30.597157 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: discovered 2 backends for service sssp-test-local-az

Subsequent jitter
I, [2019-06-14T01:18:31.114913 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: sleeping for discovery_jitter=25 seconds for service:sssp-test-regional
I, [2019-06-14T01:18:31.114975 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: sleeping for discovery_jitter=25 seconds for service:sssp-test-local-az
I, [2019-06-14T01:18:31.115191 #18252]  INFO -- Synapse::ServiceWatcher::ZookeeperWatcher: synapse: sleeping for discovery_jitter=25 seconds for service:sssp-test
Ramyak commented 5 years ago

Will update verison later.