From 2549521dbe5bf53dcd6abe2c1a196f25243b3409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Mon, 29 Aug 2022 12:08:23 -0400 Subject: [PATCH] fix: extend the batch timeout This mitigates #858, which shows that on Github, this timeout is nto large enough. We also suspect this may alleviate issues encountered in Sui, e.g. failures in the Sui reconfiguration end_to_end test. --- primary/src/block_waiter.rs | 7 ++++++- primary/src/tests/block_waiter_tests.rs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/primary/src/block_waiter.rs b/primary/src/block_waiter.rs index 0e96d60da..c4699a7fa 100644 --- a/primary/src/block_waiter.rs +++ b/primary/src/block_waiter.rs @@ -30,7 +30,12 @@ use types::{ }; use Result::*; -const BATCH_RETRIEVE_TIMEOUT: Duration = Duration::from_secs(1); +//TODO [860]: customize the configuration of the block waiter to allow distinct +// settings for NW block waiter settings when deployed in different contexts. +// Indeed, this is used for NW + external consensus in the validator API (where +// latency is key) as well as NW + internal consensus, in the Executor +// (see #738, there reliability is key). +const BATCH_RETRIEVE_TIMEOUT: Duration = Duration::from_secs(10); #[cfg(test)] #[path = "tests/block_waiter_tests.rs"] diff --git a/primary/src/tests/block_waiter_tests.rs b/primary/src/tests/block_waiter_tests.rs index 646626f2f..df1039f9d 100644 --- a/primary/src/tests/block_waiter_tests.rs +++ b/primary/src/tests/block_waiter_tests.rs @@ -4,6 +4,7 @@ use crate::{ block_synchronizer::{handler, handler::MockHandler}, block_waiter::{ BatchResult, BlockError, BlockErrorKind, BlockResult, GetBlockResponse, GetBlocksResponse, + BATCH_RETRIEVE_TIMEOUT, }, BlockCommand, BlockWaiter, PrimaryWorkerMessage, }; @@ -536,7 +537,8 @@ async fn test_batch_timeout() { .unwrap(); // THEN we should expect to get back the result - let timer = sleep(Duration::from_millis(5_000)); + // TODO: make sure we can run this test in less than the actual timeout range + let timer = sleep(BATCH_RETRIEVE_TIMEOUT + Duration::from_secs(2)); tokio::pin!(timer); tokio::select! {