File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -444,6 +444,8 @@ impl LighthouseService for Arc<Lighthouse> {
444
444
. requester
445
445
. ok_or_else ( || return Status :: invalid_argument ( "missing requester" ) ) ?;
446
446
447
+ let requester_id = requester. replica_id . clone ( ) ;
448
+ let requester_copy = requester. clone ( ) ;
447
449
info ! ( "got quorum request for replica {}" , & requester. replica_id) ;
448
450
449
451
let mut rx = {
@@ -471,7 +473,28 @@ impl LighthouseService for Arc<Lighthouse> {
471
473
rx
472
474
} ;
473
475
474
- let quorum = rx. recv ( ) . await . map_err ( |e| Status :: from_error ( e. into ( ) ) ) ?;
476
+ let quorum = loop {
477
+ let current_quorum = rx. recv ( ) . await . map_err ( |e| Status :: from_error ( e. into ( ) ) ) ?;
478
+
479
+ if current_quorum
480
+ . participants
481
+ . iter ( )
482
+ . any ( |p| p. replica_id == requester_id)
483
+ {
484
+ break current_quorum;
485
+ }
486
+
487
+ // Only continue the loop if the replica is not in the quorum
488
+ let mut state = self . state . lock ( ) . await ;
489
+ state. participants . insert (
490
+ requester_id. clone ( ) ,
491
+ QuorumMemberDetails {
492
+ joined : Instant :: now ( ) ,
493
+ member : requester_copy. clone ( ) ,
494
+ } ,
495
+ ) ;
496
+ info ! ( "Replica {} not in quorum, retrying" , requester_id) ;
497
+ } ;
475
498
476
499
let reply = LighthouseQuorumResponse {
477
500
quorum : Some ( quorum) ,
You can’t perform that action at this time.
0 commit comments