Files
nginx-unit/test/python/lifespan/failed/asgi.py
2020-10-05 11:05:00 +01:00

12 lines
455 B
Python

async def application(scope, receive, send):
if scope['type'] == 'lifespan':
while True:
message = await receive()
if message['type'] == 'lifespan.startup':
await send({"type": "lifespan.startup.failed"})
raise Exception('Exception blah')
elif message['type'] == 'lifespan.shutdown':
await send({'type': 'lifespan.shutdown.complete'})
return