diff --git a/crates/botloftd/tests/rpc_queue.rs b/crates/botloftd/tests/rpc_queue.rs index 906cd58b..d3376cbd 100644 --- a/crates/botloftd/tests/rpc_queue.rs +++ b/crates/botloftd/tests/rpc_queue.rs @@ -31,6 +31,11 @@ async fn race(c: &mut Crew, request: Value) -> Vec<&'static str> { }); is_locked.recv().expect("store held"); c.app.send_raw(&request.to_string()).await; + // Give the daemon time to take the request off the socket, so the text + // comes after it. Nothing shows when it has, but this is far below the + // time the store is held. A thread sleep, because the runtime's timers + // may not fire while the daemon's tasks wait for the store. + std::thread::sleep(Duration::from_millis(200)); // The block that ends sends the text at once, without the timer. let stop = json!({ "type": "stream_event", "event": { "type": "content_block_stop", "index": 0 } });