Fixed startup email

This commit is contained in:
Jonas Linter
2025-10-16 10:53:03 +02:00
parent 90e253b950
commit 6ad4df6990
4 changed files with 336 additions and 31 deletions

View File

@@ -299,10 +299,11 @@ async def lifespan(app: FastAPI):
report_scheduler.set_stats_collector(stats_collector.collect_stats)
_LOGGER.info("Stats collector initialized and hooked up to report scheduler")
# Send a test daily report on startup for testing
_LOGGER.info("Sending test daily report on startup")
# Send a test daily report on startup for testing (with 24-hour lookback)
_LOGGER.info("Sending test daily report on startup (last 24 hours)")
try:
stats = await stats_collector.collect_stats()
# Use lookback_hours=24 to get stats from last 24 hours
stats = await stats_collector.collect_stats(lookback_hours=24)
success = await email_service.send_daily_report(
recipients=report_scheduler.recipients,
stats=stats,