cluster: get first peerset from configuration
make sure we save a new config if the new peerset is different than the one in the configuration at boot. Hopefully this fixes a race condition in PeerAdd test License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
parent
a656e45375
commit
1f93662b3e
|
@ -344,11 +344,7 @@ func (c *Cluster) alertsHandler() {
|
|||
func (c *Cluster) watchPeers() {
|
||||
// TODO: Config option?
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
var lastPeers []peer.ID
|
||||
lastPeers, err := c.consensus.Peers()
|
||||
if err != nil {
|
||||
logger.Error("starting to watch peers", err)
|
||||
}
|
||||
lastPeers := peersFromMultiaddrs(c.config.Peers)
|
||||
|
||||
for {
|
||||
select {
|
||||
|
|
|
@ -92,7 +92,8 @@ func TestClustersPeerAdd(t *testing.T) {
|
|||
// This only works because each peer only has one multiaddress
|
||||
// (localhost)
|
||||
if len(c.config.Peers) != nClusters-1 {
|
||||
t.Error("expected different cluster peers in the configuration")
|
||||
t.Error(c.config.Peers)
|
||||
t.Errorf("%s: expected different cluster peers in the configuration", c.id)
|
||||
}
|
||||
|
||||
for _, peer := range c.config.Peers {
|
||||
|
|
Loading…
Reference in New Issue
Block a user