Skip to content

Background Automations

Automated background processes that run on scheduled intervals. For the full Celery task schedule, see Worker Schedule.

Postage Downgrade

Automatically transitions US campaigns from first-class to standard postage after a configurable period to optimize mailing costs.

Schedule: Daily at 2 AM Eastern

Config: - POSTAGE_DOWNGRADE_ENABLED — Enable/disable (default: False) - POSTAGE_DOWNGRADE_DAYS — Days after first send to trigger (default: 30, range: 1-365)

Eligibility criteria (all must be met): 1. First send exactly N days ago (cached in campaign.json->>'first_send_date') 2. postage_service_level = "first_class" 3. Status is "Active" 4. US template size (4x6, 6x9, 6x18_bifold, 12x9_bifold) 5. Not already processed (Redis dedup with 24h TTL)

Only affects future mailers — existing/sent mailers are unchanged.

first_send_date caching: The process_reporting_sync job (app/celery/reporting_sync.py) generates campaign stats including first send date and caches it in campaign.json->>'first_send_date'. This avoids expensive MIN(sent_at) aggregation at query time.

Key files: - app/celery/automator.py — Scheduled job and processing logic - app/core/models/campaigns.py — Eligibility query - app/celery/reporting_sync.py — first_send_date caching

CSM Cadence Update

Automatically transitions organizations from weekly to biweekly CSM reporting after a configurable period since launch.

Schedule: Daily at 3 AM Eastern

Config: - CSM_CADENCE_UPDATE_ENABLED — Enable/disable (default: False) - CSM_CADENCE_UPDATE_WEEKS — Weeks after launch to trigger (default: 11, range: 1-52)

Organizations at exactly N weeks since launch are updated. Manual overrides are respected and won't be automatically changed.