-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support blocking queries to /health #3
Conversation
I was thinking about exposing That seem like an acceptable solution to you? |
Hi ! Do you mean having (err, res) as a callback for all calls ? or (err, data, res) ? The first option would break all existing code... the latter sounds good to me... |
Woops, I mean't the third parameter. So the callback signature would be |
it sounds like a good option... |
as for testing, it would be cool if you could tell me about your test configuration: maybe I could build a Vagrant file for easy setup of the 3 nodes... |
So you should just need Basically the helper.js script spawns a mini-cluster and waits for it to boot up. I'm going to spend some time this weekend integrating your changes and writing some nock stubs for the current tests so it's easy to run the tests even without the above setup. |
Let me know if you run into issues, thanks for reporting! |
Nice use of middlewares in rapi :-) |
Here's a very modest proposal for enhancement, to make it possible to use blocking queries with
consul.health.*
endpoints... It's backwards compatible...To use blocking queries, you must provide the
?index= param
which you obtained in the response headers of the previous call.health
HTTP responses do not include aModifyIndex
field like thekv
ones. Instead, you must use theX-Consul-Index
HTTP header... But inconsul.health
, only theres.body
is returned.This modification adds an optional
headers
parameter to the callback so the caller can get theX-Consul-Index
or other consul specific headers (do we have a leader ? time of last contact) as per the consul.io docs...If the caller implements a classic 2 params callback, the headers are silently discarded.
If he implements the 3 params callback, he'll receive the headers.
What do you think ?
Example headers: