Skip to content

Commit c70a667

Browse files
NathanFlurryMasterPtato
authored andcommitted
fix(epoxy): fix Any quorum type not reaching any node
1 parent e0afd30 commit c70a667

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/services/epoxy/src/http_client.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,21 @@ where
5454
)
5555
.collect::<FuturesUnordered<_>>()
5656
.await;
57+
tracing::info!(?quorum_size, len = ?responses.len(), ?quorum_type, "fanout quorum size");
58+
59+
// Choow how many successful responses we need before considering a success
60+
let target_responses = match quorum_type {
61+
// Only require 1 response
62+
utils::QuorumType::Any => 1,
63+
// Include all responses
64+
utils::QuorumType::All => responses.len(),
65+
// Subtract 1 from quorum size since we're not counting ourselves
66+
utils::QuorumType::Fast | utils::QuorumType::Slow => quorum_size - 1,
67+
};
5768

5869
// Collect responses until we reach quorum or all futures complete
59-
//
60-
// Subtract 1 from quorum size since we're not counting ourselves
6170
let mut successful_responses = Vec::new();
62-
while successful_responses.len() < quorum_size - 1 {
71+
while successful_responses.len() < target_responses {
6372
if let Some(response) = responses.next().await {
6473
match response {
6574
std::result::Result::Ok(result) => match result {

packages/services/epoxy/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::*;
22
use epoxy_protocol::protocol::{self, ReplicaId};
33
use universaldb::Transaction;
44

5-
#[derive(Clone, Copy)]
5+
#[derive(Clone, Copy, Debug)]
66
pub enum QuorumType {
77
Fast,
88
Slow,

packages/services/epoxy/tests/proposal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use common::THREE_REPLICAS;
44
use epoxy::ops::propose::ProposalResult;
55
use epoxy_protocol::protocol;
66
use gas::prelude::*;
7-
use rivet_acl::{Verifier, config::AclConfig};
87
use rivet_api_builder::{ApiCtx, GlobalApiCtx};
98
use rivet_util::Id;
109

0 commit comments

Comments
 (0)