Created
October 1, 2014 12:20
-
-
Save falsecz/e3df9a7f2bcf5fce686b to your computer and use it in GitHub Desktop.
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
watch -n 1 'netstat -lan | grep 2181'