From c09ece893433b483dffafb47da3adcd1f15d79ec Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 2 Jan 2018 18:14:28 +0100 Subject: [PATCH] consul: set List options for consistent results like done for the Get method set the same options also for List (the same is already done for the etcd v2 backend). Signed-off-by: Simone Gotti --- store/consul/consul.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/store/consul/consul.go b/store/consul/consul.go index cb64be72..6f876d21 100644 --- a/store/consul/consul.go +++ b/store/consul/consul.go @@ -238,7 +238,11 @@ func (s *Consul) Exists(key string) (bool, error) { // List child nodes of a given directory func (s *Consul) List(directory string) ([]*store.KVPair, error) { - pairs, _, err := s.client.KV().List(s.normalize(directory), nil) + options := &api.QueryOptions{ + AllowStale: false, + RequireConsistent: true, + } + pairs, _, err := s.client.KV().List(s.normalize(directory), options) if err != nil { return nil, err }