diff --git a/node/node.go b/node/node.go index 5dbc25455a482b59b8c968fab1f0a3109b44e9f2..252225431e79c8370781a70ef183129f2550a813 100644 --- a/node/node.go +++ b/node/node.go @@ -201,6 +201,15 @@ func (w *ConfigSyncer) Start() { } else if err != nil { // Log the error and start over. log.Printf("Watch(): %s", err) + + // If the error is code 401 ("index + // out of date"), start from the + // current index. TODO: consider + // calling loadFullConfig, or we might + // potentially lose some updates? + if etcdErr, ok := err.(*etcd.EtcdError); ok && etcdErr.ErrorCode == 401 { + w.setIndex(etcdErr.Index) + } } } }()