Consul go api: WaitIndex in QueryOptions struct

141 views
Skip to first unread message

Andreas

unread,
Feb 20, 2018, 8:54:32 AM2/20/18
to Consul
Hi,

I just want to verify that setting WaitIndex to 0 means that the request will not block?
If so, does this mean that X-Consul-Index can never be 0?

Thanks!

Kyle Havlovitz

unread,
Feb 20, 2018, 4:44:08 PM2/20/18
to consu...@googlegroups.com
Hi Andreas, that's correct - the X-Consul-Index will never be 0 because there's a few things that get written to the state store when Consul starts up for the first time, such as the Autopilot config. This causes the index to increment, so it effectively will never be 0.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
Community chat: https://gitter.im/hashicorp-consul/Lobby
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/22613aa7-c1a4-4bce-b237-1b593ec9fd31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pba...@hashicorp.com

unread,
Feb 21, 2018, 8:05:17 AM2/21/18
to Consul
Also note that if you GET a KV or service etc that doesn't exist, you'll still see a ModifiedIndex (and X-Consul-Index) that is always greater than zero allowing you to use that in a blocking watch to wait for it to show up.

On Tuesday, February 20, 2018 at 9:44:08 PM UTC, Kyle Havlovitz wrote:
Hi Andreas, that's correct - the X-Consul-Index will never be 0 because there's a few things that get written to the state store when Consul starts up for the first time, such as the Autopilot config. This causes the index to increment, so it effectively will never be 0.
On Tue, Feb 20, 2018 at 5:54 AM, Andreas <mrho...@gmail.com> wrote:
Hi,

I just want to verify that setting WaitIndex to 0 means that the request will not block?
If so, does this mean that X-Consul-Index can never be 0?

Thanks!

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
Community chat: https://gitter.im/hashicorp-consul/Lobby
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages