consul-node
consul-node copied to clipboard
KV.watch a key for change
I know it's just a convenience, but I thought you might like it. kv.watch allow you to get the value of a key, and to be called back each time the key is changed, until you decide to stop it. It uses HTTP long polling, and retries every second in case of Consul error (handler will receive errors too).
I've added unit tests, but the last one takes 11s to run (waiting for an http timeout).