func (c *etcdCtx) GetPeers() (torus.PeerInfoList, error) { promOps.WithLabelValues("get-peers").Inc() resp, err := c.etcd.Client.Get(c.getContext(), MkKey("nodes"), etcdv3.WithPrefix()) if err != nil { return nil, err } var out []*models.PeerInfo for _, x := range resp.Kvs { var p models.PeerInfo err := p.Unmarshal(x.Value) if err != nil { // Intentionally ignore a peer that doesn't unmarshal properly. clog.Errorf("peer at key %s didn't unmarshal correctly", string(x.Key)) continue } if time.Since(time.Unix(0, p.LastSeen)) > peerTimeoutMax { clog.Warningf("peer at key %s didn't unregister; should be fixed with leases in etcdv3", string(x.Key)) continue } out = append(out, &p) } return torus.PeerInfoList(out), nil }