Mercurial > lbo > hg > clusterconsensus
changeset 43:2995d688667f
Slight improvements to asynchronous Accept
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 26 Jul 2019 11:23:22 +0200 |
parents | 0dd3054a993c |
children | 3f480e231923 |
files | consensus.go consensus_impl.go example_clusterrpc/example.go |
diffstat | 3 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/consensus.go Fri Jul 26 07:55:02 2019 +0200 +++ b/consensus.go Fri Jul 26 11:23:22 2019 +0200 @@ -23,6 +23,8 @@ instance: 0, sequence: 0, + failedSubmits: 0, + state: initialState, participantState: state_UNJOINED,
--- a/consensus_impl.go Fri Jul 26 07:55:02 2019 +0200 +++ b/consensus_impl.go Fri Jul 26 11:23:22 2019 +0200 @@ -28,7 +28,7 @@ // TODO: Use contexts var localMx sync.Mutex - wait := make(chan bool, requiredVotes) + wait := make(chan bool, len(p.members)) p.Unlock() // Send out Accept() requests @@ -47,7 +47,6 @@ member := member go func() { ok, err := client.Accept(p.instance, p.sequence+1, c) - if err != nil { glog.Error("client ", member, " did not accept: ", err) localMx.Lock()
--- a/example_clusterrpc/example.go Fri Jul 26 07:55:02 2019 +0200 +++ b/example_clusterrpc/example.go Fri Jul 26 11:23:22 2019 +0200 @@ -568,8 +568,10 @@ continue } if i%5 == 0 { + participant.Lock() glog.Info("master? ", participant.IsMaster(), " state len: ", len(participant.GetState().(State).inner), " state: ", participant.GetState().(State)) + participant.Unlock() } i++ }