mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Allow more time for local code-mode host startup (#39940)
## What changed Use a 30-second handshake timeout for locally spawned code-mode hosts while retaining the existing 10-second timeout for WebSocket connections. GitOrigin-RevId: de1801c062b5c71d4c7b2c33a53b51e0b672445e
This commit is contained in:
@@ -66,6 +66,7 @@ mod transport;
|
||||
|
||||
const IPC_CHANNEL_CAPACITY: usize = 128;
|
||||
const HOST_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
const LOCAL_HOST_STARTUP_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
// TODO(anp) make this timeout configurable if 60 seconds is insufficient.
|
||||
const DEFAULT_HOST_WAIT_TRANSPORT_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
const MAX_WEBSOCKET_FRAME_BYTES: usize = MAX_FRAME_BYTES + std::mem::size_of::<u32>();
|
||||
@@ -345,7 +346,11 @@ impl Connection {
|
||||
None => Err("code-mode host exited during handshake".to_string()),
|
||||
}
|
||||
};
|
||||
let handshake_result = match tokio::time::timeout(HOST_HANDSHAKE_TIMEOUT, handshake).await {
|
||||
let handshake_timeout = match &owner {
|
||||
ConnectionOwner::Process(_) => LOCAL_HOST_STARTUP_TIMEOUT,
|
||||
ConnectionOwner::WebSocket => HOST_HANDSHAKE_TIMEOUT,
|
||||
};
|
||||
let handshake_result = match tokio::time::timeout(handshake_timeout, handshake).await {
|
||||
Ok(result) => result,
|
||||
Err(_) => {
|
||||
let _ = writer.close().await;
|
||||
|
||||
Reference in New Issue
Block a user