debug: logs in steps in precahing
All checks were successful
Deploy on push / deploy (push) Successful in 47s

This commit is contained in:
Stepan Vladovskiy
2025-05-19 16:19:27 -03:00
parent 1690ed63aa
commit 2235fb6537
2 changed files with 51 additions and 5 deletions

15
cache/precache.py vendored
View File

@@ -97,6 +97,10 @@ async def precache_data():
await redis.execute("HSET", key, *value)
logger.info(f"redis hash '{key}' was restored")
# Set a start time to track total execution time
import time
start_time = time.time()
with local_session() as session:
# topics
q = select(Topic).where(Topic.community == 1)
@@ -153,8 +157,19 @@ async def precache_data():
import traceback
logger.error(f"Error processing authors: {author_exc}")
logger.error(traceback.format_exc())
# Calculate total execution time and log it
import time
end_time = time.time()
execution_time = end_time - start_time
logger.info(f"Total precache execution time: {execution_time:.2f} seconds")
# Double-check that we're actually returning and not getting stuck somewhere
logger.info("Precache operation complete - returning to caller")
return True
except Exception as exc:
import traceback
traceback.print_exc()
logger.error(f"Error in precache_data: {exc}")
return False