File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed
services/api-server/src/simcore_service_api_server/core Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change 1616from ..services_http import catalog , director_v2 , storage , webserver
1717from ..services_http .rabbitmq import setup_rabbitmq
1818from ._prometheus_instrumentation import setup_prometheus_instrumentation
19- from .events import create_start_app_handler , create_stop_app_handler
19+ from .events import on_shutdown , on_startup
2020from .openapi import override_openapi_method , use_route_names_as_operation_ids
2121from .settings import ApplicationSettings
2222
@@ -119,8 +119,8 @@ def init_app(settings: ApplicationSettings | None = None) -> FastAPI:
119119 )
120120
121121 # setup app
122- app .add_event_handler ("startup" , create_start_app_handler ( app ) )
123- app .add_event_handler ("shutdown" , create_stop_app_handler ( app ) )
122+ app .add_event_handler ("startup" , on_startup )
123+ app .add_event_handler ("shutdown" , on_shutdown )
124124
125125 exceptions .setup_exception_handlers (
126126 app , is_debug = settings .SC_BOOT_MODE == BootModeEnum .DEBUG
Original file line number Diff line number Diff line change 11import logging
2- from collections .abc import Callable
3-
4- from fastapi import FastAPI
52
63from .._meta import APP_FINISHED_BANNER_MSG , APP_STARTED_BANNER_MSG
74
85_logger = logging .getLogger (__name__ )
96
107
11- def create_start_app_handler (app : FastAPI ) -> Callable :
12- async def _on_startup () -> None :
13- _logger .info ("Application starting ..." )
14- print (APP_STARTED_BANNER_MSG , flush = True ) # noqa: T201
15-
16- return _on_startup
17-
8+ async def on_startup () -> None :
9+ _logger .info ("Application starting ..." )
10+ print (APP_STARTED_BANNER_MSG , flush = True ) # noqa: T201
1811
19- def create_stop_app_handler (app : FastAPI ) -> Callable :
20- async def _on_shutdown () -> None :
21- _logger .info ("Application stopping, ..." )
22- print (APP_FINISHED_BANNER_MSG , flush = True ) # noqa: T201
2312
24- return _on_shutdown
13+ async def on_shutdown () -> None :
14+ _logger .info ("Application stopping, ..." )
15+ print (APP_FINISHED_BANNER_MSG , flush = True ) # noqa: T201
You can’t perform that action at this time.
0 commit comments