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:
|
try:
|
||||||
print("[lifespan] Starting application initialization")
|
print("[lifespan] Starting application initialization")
|
||||||
create_all_tables()
|
create_all_tables()
|
||||||
|
|
||||||
# schedule precaching in background to avoid blocking startup
|
# 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(
|
await asyncio.gather(
|
||||||
redis.connect(),
|
redis.connect(),
|
||||||
ViewedStorage.init(),
|
ViewedStorage.init(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user