GapFill Flowee

This commit is contained in:
2026-06-18 11:24:05 +02:00
parent 64442af182
commit c68daf4313
25 changed files with 2965 additions and 48 deletions
+13 -3
View File
@@ -19,13 +19,14 @@ import sys
from typing import Any
import redis.asyncio as aioredis
from arq import run_worker
from arq import cron, run_worker
from arq.connections import RedisSettings
from app.config import get_settings
from app.imap.pool import MailboxPool
from app.jobs.apply_routing_rules import apply_routing_rules
from app.jobs.dispatch_notification import dispatch_notification
from app.jobs.run_conservation import run_conservation
from app.jobs.send_pec import send_pec
from app.jobs.sync_mailbox import sync_mailbox
from app.smtp.receipt_watcher import watch_receipt
@@ -133,9 +134,17 @@ def _parse_redis_settings() -> RedisSettings:
class WorkerSettings:
"""Configurazione del worker arq."""
# Funzioni/job registrati
# Funzioni/job registrati (code-driven, on-demand)
functions = [sync_mailbox, send_pec, watch_receipt, dispatch_notification, apply_routing_rules, health_check]
# Job schedulati (cron)
# run_conservation: ogni giorno alle 16:00 UTC = 18:00 ora Italia (CEST, UTC+2)
# Nota: arq usa sempre UTC per i cron. In orario solare (CET, UTC+1) il job
# viene eseguito alle 17:00 ora Italia differenza accettabile.
cron_jobs = [
cron(run_conservation, hour=16, minute=0),
]
# Callbacks lifecycle
on_startup = on_startup
on_shutdown = on_shutdown
@@ -148,7 +157,8 @@ class WorkerSettings:
# Timeout per ogni job (secondi)
# send_pec può richiedere più tempo su SMTP lenti
job_timeout = 120
# run_conservation può richiedere più tempo per batch grandi
job_timeout = 300
# Retry automatico in caso di errore
max_tries = 3