Skip to content

Commit 34e891c

Browse files
fix: restore shutdown timeout
1 parent d0ceabf commit 34e891c

File tree

1 file changed

+6
-1
lines changed
  • packages/service-library/src/servicelib/fastapi/celery

1 file changed

+6
-1
lines changed

packages/service-library/src/servicelib/fastapi/celery/app_server.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
import datetime
2+
from typing import Final
3+
14
from asgi_lifespan import LifespanManager
25
from fastapi import FastAPI
36

47
from ...celery.app_server import BaseAppServer
58

9+
_SHUTDOWN_TIMEOUT: Final[float] = datetime.timedelta(seconds=10).total_seconds()
10+
611

712
class FastAPIAppServer(BaseAppServer[FastAPI]):
813
def __init__(self, app: FastAPI):
@@ -13,7 +18,7 @@ async def on_startup(self) -> None:
1318
self._lifespan_manager = LifespanManager(
1419
self.app,
1520
startup_timeout=None, # waits for full app initialization (DB migrations, etc.)
16-
shutdown_timeout=None,
21+
shutdown_timeout=_SHUTDOWN_TIMEOUT,
1722
)
1823
await self._lifespan_manager.__aenter__()
1924

0 commit comments

Comments
 (0)