Skip to content

Commit 61dbcc8

Browse files
committed
perf: extend keepAlive timeout from 60s to 180s
2 parents b2544b8 + 87d52ad commit 61dbcc8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/common/openai-client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import OpenAI from "openai";
55
import { Agent, fetch as undiciFetch } from "undici";
66
import { resolveCurrentSettings } from "../ui/App";
77

8-
// Custom undici Agent with a 60-second keepAlive timeout. The default
8+
// Custom undici Agent with a 180-second keepAlive timeout. The default
99
// global fetch (undici) only keeps connections alive for 4 seconds, which
1010
// is too short for a CLI where the user may spend 10–30 seconds reading
1111
// output between prompts. By passing a dedicated Agent to undiciFetch we
12-
// keep connections reusable for a full minute after the last request.
13-
const keepAliveAgent = new Agent({ keepAliveTimeout: 60_000 });
12+
// keep connections reusable for three minutes after the last request.
13+
const keepAliveAgent = new Agent({ keepAliveTimeout: 180_000 });
1414

1515
// Module-level cache for the OpenAI client instance. The client itself is
1616
// a stateless fetch wrapper, so it is safe to share across calls as long as

0 commit comments

Comments
 (0)