INNER CODE UNIT · Python
_ensure_db
CassiopeiaCode/q2api · app.py:320
async def _ensure_db():
"""Initialize database backend."""
global _db
_db = await init_db()
def _row_to_dict(r: Dict[str, Any]) -> Dict[str, Any]:
"""Convert database row to dict with JSON parsing."""
return row_to_dict(r)
# _ensure_db() will be called in startup event
# ------------------------------------------------------------------------------
# Background token refresh thread
# ------------------------------------------------------------------------------
async def _refresh_stale_tokens():
while True:
try: