Created
October 27, 2015 19:43
-
-
Save davidbirdsong/6a74597f7feb31f411ff to your computer and use it in GitHub Desktop.
vanilla.consul fd leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vanilla, vanilla.consul | |
import consul | |
c = consul.Consul() | |
_, d = c.health.service('mogtracker', passing=1) | |
for row in d: | |
print '%s:%d' % (row['Node']['Address'], row['Service']['Port']) | |
h = vanilla.Hub() | |
def Changes(h, service): | |
sender, recver = h.pipe() | |
@h.spawn | |
def _(): | |
c = h.consul() | |
index = None | |
while True: | |
index, nodes = c.health.service(service, index=index).recv() | |
sender.send(nodes) | |
return recver | |
for changes in Changes(h, 'hwy-store'): | |
print changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment