node-etcd
node-etcd copied to clipboard
Broken response in watcher doesn't back off
If the watcher catches a change and the response is broken, or for some reason can't be parsed, but the etcd server still responds with something, we end up in an endless loop.
It seems to me like it should use the _retry method here instead of directly calling _watch here https://github.com/stianeikeland/node-etcd/blob/master/src/watcher.coffee#L51
else
error = new Error 'Received unexpected response'
error.response = val;
@emit 'error', error
@_watch()
Behaviour we're experiencing is that it retries every tick, which crashes the server by using all available cpu.
At the same time, a back off algorithm would be nice. :)
Thanks for PR, merged in https://github.com/stianeikeland/node-etcd/commit/39ea3456656e0a20f4f41042ae65e5042798f3bd :)