debug: with timeout for prechashing
This commit is contained in:
parent
44aef147b5
commit
1ada0a02f9
7
main.py
7
main.py
|
@ -52,8 +52,13 @@ async def lifespan(_app):
|
|||
try:
|
||||
print("[lifespan] Starting application initialization")
|
||||
create_all_tables()
|
||||
|
||||
# schedule precaching in background to avoid blocking startup
|
||||
asyncio.create_task(precache_data())
|
||||
asyncio.create_task(
|
||||
asyncio.wait_for(precache_data(), timeout=60)
|
||||
.catch(asyncio.TimeoutError, lambda _: print("Precache timed out"))
|
||||
)
|
||||
|
||||
await asyncio.gather(
|
||||
redis.connect(),
|
||||
ViewedStorage.init(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user