Skip to content

Commit 9bd27a6

Browse files
ninan-nnPangjiping
authored andcommitted
feat(server): refine uvicorn timeout keep alive
1 parent cedfda2 commit 9bd27a6

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

server/opensandbox_server/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def main() -> None:
292292
port=server_main.app_config.server.port,
293293
reload=args.reload,
294294
log_config=server_main._log_config,
295+
timeout_keep_alive=server_main.app_config.server.timeout_keep_alive,
295296
)
296297

297298

server/opensandbox_server/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ class ServerConfig(BaseModel):
240240
le=65535,
241241
description="Port exposed by the lifecycle API server.",
242242
)
243+
timeout_keep_alive: int = Field(
244+
default=30,
245+
ge=1,
246+
description=(
247+
"Idle keep-alive timeout in seconds passed to uvicorn. "
248+
"Connections idle longer than this may be closed by the server."
249+
),
250+
)
243251
log_level: str = Field(
244252
default="INFO",
245253
description="Python logging level for the server process.",

server/opensandbox_server/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,5 @@ async def health_check():
227227
port=app_config.server.port,
228228
reload=True,
229229
log_config=_log_config,
230+
timeout_keep_alive=app_config.server.timeout_keep_alive,
230231
)

0 commit comments

Comments
 (0)