Skip to content

Commit f16a799

Browse files
committed
refactor: make cloning more consistent
1 parent 95f012c commit f16a799

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lighthouse.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ impl LighthouseService for Arc<Lighthouse> {
444444
.requester
445445
.ok_or_else(|| return Status::invalid_argument("missing requester"))?;
446446

447-
let requester_id = requester.replica_id.clone();
448-
let requester_copy = requester.clone();
449447
info!("got quorum request for replica {}", &requester.replica_id);
450448

451449
let mut rx = {
@@ -460,7 +458,7 @@ impl LighthouseService for Arc<Lighthouse> {
460458
requester.replica_id.clone(),
461459
QuorumMemberDetails {
462460
joined: Instant::now(),
463-
member: requester,
461+
member: requester.clone(),
464462
},
465463
);
466464
let rx = state.channel.subscribe();
@@ -479,21 +477,21 @@ impl LighthouseService for Arc<Lighthouse> {
479477
if current_quorum
480478
.participants
481479
.iter()
482-
.any(|p| p.replica_id == requester_id)
480+
.any(|p| p.replica_id == requester.replica_id)
483481
{
484482
break current_quorum;
485483
}
486484

487485
// Only continue the loop if the replica is not in the quorum
488486
let mut state = self.state.lock().await;
489487
state.participants.insert(
490-
requester_id.clone(),
488+
requester.replica_id.clone(),
491489
QuorumMemberDetails {
492490
joined: Instant::now(),
493-
member: requester_copy.clone(),
491+
member: requester.clone(),
494492
},
495493
);
496-
info!("Replica {} not in quorum, retrying", requester_id);
494+
info!("Replica {} not in quorum, retrying", &requester.replica_id);
497495
};
498496

499497
let reply = LighthouseQuorumResponse {

0 commit comments

Comments
 (0)