Skip to content

Commit

Permalink
Merge pull request #170 from ZenGround0/fix/raft-rejoin-errors
Browse files Browse the repository at this point in the history
Fix/raft rejoin errors
  • Loading branch information
ZenGround0 committed Oct 12, 2017
2 parents 9663de5 + a5de825 commit 180807b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ func (c *Cluster) Shutdown() error {
} else {
time.Sleep(2 * time.Second)
}
c.config.unshadow()
c.config.Bootstrap = c.peerManager.peersAddrs()
c.config.Save("")
c.peerManager.resetPeers()
}

Expand Down
4 changes: 2 additions & 2 deletions docker/cluster-restart.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#! /bin/bash

# Restart the cluster process
sleep 2
sleep 4
while true; do
export CLUSTER_SECRET=""
pgrep ipfs-cluster-service || ipfs-cluster-service -f init; echo "CLUSTER RESTARTED"; ipfs-cluster-service --debug &
pgrep ipfs-cluster-service || echo "CLUSTER RESTARTING"; ipfs-cluster-service --debug &
sleep 10
done
3 changes: 3 additions & 0 deletions peer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func (pm *peerManager) rmPeer(pid peer.ID, selfShutdown bool) error {
go func() {
time.Sleep(1 * time.Second)
pm.cluster.consensus.Shutdown()
pm.cluster.config.unshadow()
pm.cluster.config.Bootstrap = pm.peersAddrs()
pm.cluster.config.Save("")
pm.resetPeers()
time.Sleep(4 * time.Second)
pm.cluster.Shutdown()
Expand Down

0 comments on commit 180807b

Please sign in to comment.