Пример #1
0
def LifespanAuto(config):
    if not config.loaded:
        config.load()

    try:
        config.loaded_app({"type": "lifespan"})
    except BaseException as exc:
        config.logger_instance.debug(
            "Lifespan protocol is not recognized by the application.")
        return LifespanOff(config)
    else:
        return LifespanOn(config)
Пример #2
0
    async def test():
        config = Config(app=app, lifespan="off")
        lifespan = LifespanOff(config)

        await lifespan.startup()
        await lifespan.shutdown()