Fix: resolved sqlite concurrency errors (table users already exists) by moving DDL to explicit async initialize() and implementing lazy singleton dependency.
This commit is contained in:
@@ -305,16 +305,18 @@ def mutate(
|
||||
from decnet.mutator import mutate_decky, mutate_all, run_watch_loop
|
||||
from decnet.web.dependencies import repo
|
||||
|
||||
if watch:
|
||||
asyncio.run(run_watch_loop(repo))
|
||||
return
|
||||
async def _run() -> None:
|
||||
await repo.initialize()
|
||||
if watch:
|
||||
await run_watch_loop(repo)
|
||||
elif decky_name:
|
||||
await mutate_decky(decky_name, repo)
|
||||
elif force_all:
|
||||
await mutate_all(force=True, repo=repo)
|
||||
else:
|
||||
await mutate_all(force=False, repo=repo)
|
||||
|
||||
if decky_name:
|
||||
asyncio.run(mutate_decky(decky_name, repo))
|
||||
elif force_all:
|
||||
asyncio.run(mutate_all(force=True, repo=repo))
|
||||
else:
|
||||
asyncio.run(mutate_all(force=False, repo=repo))
|
||||
asyncio.run(_run())
|
||||
|
||||
|
||||
@app.command()
|
||||
|
||||
Reference in New Issue
Block a user