INNER CODE UNIT · Python

init_state

gbtami/pychess-variants · server/server.py:184

async def init_state(app: Application) -> None:
    startup = StartupTimer(log, "init_state")

    with startup.phase("ensure db handle"):
        if db_key not in app:
            app[db_key] = None

    with startup.phase("construct global app state"):
        app[pychess_global_app_state_key] = PychessGlobalAppState(app)
        app_state = app[pychess_global_app_state_key]

    with startup.phase("load state from database"):
        await app_state.init_from_db()

    with startup.phase("ensure forum categories"):
        from forum.storage import ensure_categs

        await ensure_categs(app_state)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…