🔍 Overview

These tasks monitor active Tracking Domain Pipelines and automate failover:

  • detect unsafe/unreachable tracking domains
  • block and switch pipelines to the next backup domain
  • optionally update Voluum campaigns when switching
  • optionally create an Affise switch request when switching

Tracking domain notifications are sent via the tracking-domain Telegram bot.


⏱ Schedule (Celery Beat)

Configured in config/settings.py:

  • check_active_tracking_domains_via_gsb_task — every CHECK_ACTIVE_LINKS_INTERVAL seconds
  • check_active_tracking_domains_via_gsc_task — every hour (minute 0)
  • check_blocked_tracking_domains_task — every 2 hours

🧩 Tasks

1) Active tracking domains check (Google Safe Browsing)

  • loads active_domain values from active pipelines
  • checks domains via Google Safe Browsing
  • for unsafe domains: enqueues block_active_tracking_domain_task(domain, reason)
  • triggers DNS check task afterwards

2) Active tracking domains check (DNS)

  • for each active domain that is not resolvable:
    • enqueues block_active_tracking_domain_task(domain, reason=DNS_NOT_RESOLVABLE)

3) Active tracking domains check (Google Search Console)

  • creates a DomainSafetyRequest for each active pipeline domain
  • callback can trigger blocking/switching if the domain is unsafe

4) Block active tracking domain

block_active_tracking_domain_task:

  • finds the pipeline where active_domain == domain
  • calls TrackingDomainPipeline.block_active_domain(reason)
  • pipeline switches to next_domain (if available)
  • if with_update_voluum=True, pipeline also updates Voluum campaigns
  • if with_update_affise=True, pipeline creates an AffiseSwitchRequest to update offer fields (trafficback_url, url)

5) Blocked tracking domains re-check (Google Safe Browsing)

  • collects domains stored in blocked_domains across active pipelines
  • if a domain is now safe:
    • enqueues unblock_blocked_tracking_domain_task(domain)

6) Unblock blocked tracking domain

  • finds pipelines that contain the domain in blocked_domains
  • calls TrackingDomainPipeline.unblock_domain(domain)
  • if return_to_work=True, pipeline returns the domain back into active/backup slots