Michele Dolfi commited on
Commit
7d9c9b8
·
unverified ·
1 Parent(s): cb32744

fix: increase timeout_keep_alive and allow parameter changes (#98)

Browse files
docling_serve/__main__.py CHANGED
@@ -135,6 +135,7 @@ def _run(
135
  workers=uvicorn_settings.workers,
136
  root_path=uvicorn_settings.root_path,
137
  proxy_headers=uvicorn_settings.proxy_headers,
 
138
  )
139
 
140
 
@@ -186,6 +187,9 @@ def dev(
186
  )
187
  ),
188
  ] = uvicorn_settings.proxy_headers,
 
 
 
189
  # docling options
190
  artifacts_path: Annotated[
191
  Optional[Path],
@@ -213,6 +217,7 @@ def dev(
213
  uvicorn_settings.reload = reload
214
  uvicorn_settings.root_path = root_path
215
  uvicorn_settings.proxy_headers = proxy_headers
 
216
 
217
  _run(
218
  command="dev",
@@ -277,6 +282,9 @@ def run(
277
  )
278
  ),
279
  ] = uvicorn_settings.proxy_headers,
 
 
 
280
  # docling options
281
  artifacts_path: Annotated[
282
  Optional[Path],
@@ -307,6 +315,7 @@ def run(
307
  uvicorn_settings.workers = workers
308
  uvicorn_settings.root_path = root_path
309
  uvicorn_settings.proxy_headers = proxy_headers
 
310
 
311
  _run(
312
  command="run",
 
135
  workers=uvicorn_settings.workers,
136
  root_path=uvicorn_settings.root_path,
137
  proxy_headers=uvicorn_settings.proxy_headers,
138
+ timeout_keep_alive=uvicorn_settings.timeout_keep_alive,
139
  )
140
 
141
 
 
187
  )
188
  ),
189
  ] = uvicorn_settings.proxy_headers,
190
+ timeout_keep_alive: Annotated[
191
+ int, typer.Option(help="Timeout for the server response.")
192
+ ] = uvicorn_settings.timeout_keep_alive,
193
  # docling options
194
  artifacts_path: Annotated[
195
  Optional[Path],
 
217
  uvicorn_settings.reload = reload
218
  uvicorn_settings.root_path = root_path
219
  uvicorn_settings.proxy_headers = proxy_headers
220
+ uvicorn_settings.timeout_keep_alive = timeout_keep_alive
221
 
222
  _run(
223
  command="dev",
 
282
  )
283
  ),
284
  ] = uvicorn_settings.proxy_headers,
285
+ timeout_keep_alive: Annotated[
286
+ int, typer.Option(help="Timeout for the server response.")
287
+ ] = uvicorn_settings.timeout_keep_alive,
288
  # docling options
289
  artifacts_path: Annotated[
290
  Optional[Path],
 
315
  uvicorn_settings.workers = workers
316
  uvicorn_settings.root_path = root_path
317
  uvicorn_settings.proxy_headers = proxy_headers
318
+ uvicorn_settings.timeout_keep_alive = timeout_keep_alive
319
 
320
  _run(
321
  command="run",
docling_serve/settings.py CHANGED
@@ -16,6 +16,7 @@ class UvicornSettings(BaseSettings):
16
  reload: bool = False
17
  root_path: str = ""
18
  proxy_headers: bool = True
 
19
  workers: Union[int, None] = None
20
 
21
 
 
16
  reload: bool = False
17
  root_path: str = ""
18
  proxy_headers: bool = True
19
+ timeout_keep_alive: int = 60
20
  workers: Union[int, None] = None
21
 
22