Fix Celery datetime timezone crash and per-account polling interval

- Wrap account.last_check_at with _as_utc() helper before datetime
  subtraction to fix "can't subtract offset-naive and offset-aware
  datetimes" crash that silently prevented all mail account processing
- Change beat schedule from every 5 min to every 1 min so accounts
  configured with check_interval_minutes=1 are polled as expected

Agent-Logs-Url: https://github.com/christianlouis/InboxConverge/sessions/53169783-5139-43a1-bda8-709fadd0f774

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-28 17:59:22 +00:00
parent f1970e0e0f
commit d0719eff76
4 changed files with 16 additions and 3 deletions
+3 -1
View File
@@ -36,7 +36,9 @@ celery_app.conf.update(
celery_app.conf.beat_schedule = {
"process-all-mail-accounts": {
"task": "app.workers.tasks.process_all_enabled_accounts",
"schedule": crontab(minute="*/5"), # Every 5 minutes
"schedule": crontab(
minute="*"
), # Every minute (per-account interval gates actual work)
},
"cleanup-old-logs": {
"task": "app.workers.tasks.cleanup_old_logs",
+2 -2
View File
@@ -510,8 +510,8 @@ async def process_all_enabled_accounts():
for account in accounts:
# Check if it's time to check this account
if account.last_check_at:
time_since_last_check = (
datetime.now(timezone.utc) - account.last_check_at
time_since_last_check = datetime.now(timezone.utc) - _as_utc(
account.last_check_at
)
if time_since_last_check.total_seconds() < (
account.check_interval_minutes * 60