Skip to content

Commit 8661745

Browse files
committed
fix: aws deployment.
1 parent 57373dd commit 8661745

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- '*'
1010
paths:
1111
- 'runtimes/**'
12+
- 'infrastructure/**'
1213
- 'docker-compose.*'
1314
- 'dockerfiles/**'
1415
- '.github/workflows/ci.yml'

‎infrastructure/handlers/raster_handler.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ async def startup_event() -> None:
7575

7676
handler = Mangum(app, lifespan="off")
7777

78+
79+
async def _enter_lifespan() -> None:
80+
"""Run app startup without shutdown (for SnapStart snapshot initialization)."""
81+
cm = app.router.lifespan_context(app)
82+
await cm.__aenter__()
83+
84+
7885
if "AWS_EXECUTION_ENV" in os.environ:
7986
loop = asyncio.get_event_loop()
80-
loop.run_until_complete(app.router.startup())
87+
loop.run_until_complete(_enter_lifespan())

‎infrastructure/handlers/stac_handler.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ async def startup_event() -> None:
105105

106106
handler = Mangum(app, lifespan="off")
107107

108+
109+
async def _enter_lifespan() -> None:
110+
"""Run app startup without shutdown (for SnapStart snapshot initialization)."""
111+
cm = app.router.lifespan_context(app)
112+
await cm.__aenter__()
113+
114+
108115
if "AWS_EXECUTION_ENV" in os.environ:
109116
loop = asyncio.get_event_loop()
110-
loop.run_until_complete(app.router.startup())
117+
loop.run_until_complete(_enter_lifespan())

‎infrastructure/handlers/vector_handler.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ async def startup_event() -> None:
111111

112112
handler = Mangum(app, lifespan="off")
113113

114+
115+
async def _enter_lifespan() -> None:
116+
"""Run app startup without shutdown (for SnapStart snapshot initialization)."""
117+
cm = app.router.lifespan_context(app)
118+
await cm.__aenter__()
119+
120+
114121
if "AWS_EXECUTION_ENV" in os.environ:
115122
loop = asyncio.get_event_loop()
116-
loop.run_until_complete(app.router.startup())
123+
loop.run_until_complete(_enter_lifespan())

0 commit comments

Comments
 (0)