Skip to content

Instantly share code, notes, and snippets.

@falsecz
Created October 1, 2014 12:20
Show Gist options
  • Save falsecz/e3df9a7f2bcf5fce686b to your computer and use it in GitHub Desktop.
Save falsecz/e3df9a7f2bcf5fce686b to your computer and use it in GitHub Desktop.
zkwatch = require './'
blockMe = (ms) ->
console.log "Block start"
d = new Date()
while new Date - d < ms
a = 1
console.log "Block end"
zk = new zkwatch
hosts: '127.0.0.1:2181'
root: '/zktest'
reconnectTimeout: 5000
zk.once 'connected', (err) ->
console.log 'Connected'
zk.watch '/root', (err, value, zstat) ->
setTimeout () ->
blockMe 2000
, 2000
setTimeout () ->
blockMe 2000
, 10000
@falsecz
Copy link
Author

falsecz commented Oct 1, 2014

watch -n 1 'netstat -lan | grep 2181'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment