()
| 67 | |
| 68 | @asynccontextmanager |
| 69 | async def db_startup_lock(): |
| 70 | os.makedirs(data_root, exist_ok=True) |
| 71 | lock_file = open(_STARTUP_LOCK_FILE, "a+", encoding="utf-8") |
| 72 | try: |
| 73 | await asyncio.to_thread(_lock_file, lock_file) |
| 74 | yield |
| 75 | finally: |
| 76 | await asyncio.to_thread(_unlock_file, lock_file) |
| 77 | lock_file.close() |
| 78 | |
| 79 | |
| 80 | async def init_db(): |
no outgoing calls
no test coverage detected