From a82232f0eef7d7b2766fa0cbb69f49f64594e6b6 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 17 Oct 2018 12:33:59 -0700 Subject: [PATCH] always wait a max of 5 seconds for sync Client's background thread to start --- src/client.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 01f7027..0eccca5 100644 --- a/src/client.rs +++ b/src/client.rs @@ -450,7 +450,10 @@ impl ClientHandle { .expect("runtime unexpected error"); })); - wait::timeout(spawn_rx, timeout.0).expect("runtime thread cancelled")?; + // Wait up to 5 seconds for the background thread to be spawned. + // More than that and something bad is up! + wait::timeout(spawn_rx, Some(Duration::from_secs(5))) + .expect("runtime thread cancelled")?; let inner_handle = Arc::new(InnerClientHandle { tx: Some(tx),