diff --git a/port_ocean/ocean.py b/port_ocean/ocean.py index eb0e3abca7..4f85f3f3d4 100644 --- a/port_ocean/ocean.py +++ b/port_ocean/ocean.py @@ -70,6 +70,8 @@ def __init__( self.port_client, self.config.scheduled_resync_interval ) + self.app_initialized = False + def is_saas(self) -> bool: return self.config.runtime == Runtime.Saas @@ -112,7 +114,7 @@ async def execute_resync_all() -> None: ) await repeated_function() - async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + def initialize_app(self): self.fast_api_app.include_router(self.integration_router, prefix="/integration") @asynccontextmanager @@ -129,4 +131,10 @@ async def lifecycle(_: FastAPI) -> AsyncIterator[None]: signal_handler.exit() self.fast_api_app.router.lifespan_context = lifecycle + self.app_initialized = True + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + if not self.app_initialized: + self.initialize_app() + await self.fast_api_app(scope, receive, send) diff --git a/pyproject.toml b/pyproject.toml index 89d1900520..9dd8d1dcb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.13.0" +version = "0.13.1-dev01" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"