From 9cb0151544c671f2483d467a4589fdb65c467fd0 Mon Sep 17 00:00:00 2001 From: Brennan Watt Date: Fri, 2 Dec 2022 08:47:09 -0800 Subject: [PATCH] RPC unit test timeout fix (#28998) --- rpc/src/rpc_subscriptions.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc/src/rpc_subscriptions.rs b/rpc/src/rpc_subscriptions.rs index e43f3c00b56e84..47a8c597ba9584 100644 --- a/rpc/src/rpc_subscriptions.rs +++ b/rpc/src/rpc_subscriptions.rs @@ -1411,6 +1411,12 @@ pub(crate) mod tests { encoding: UiAccountEncoding::Binary, })); + // Sleep here to ensure adequate time for the async thread to fully process the + // subscribed notification before the bank transaction is processed. Without this + // sleep, the bank transaction ocassionally completes first and we hang forever + // waiting to receive a bank notification. + std::thread::sleep(Duration::from_millis(100)); + bank_forks .read() .unwrap()