Redis Channels
The Python service publishes progress and findings to Redis pub/sub; Rails consumes them in a background thread and updates the database, then broadcasts progress to browsers via ActionCable.
Channels
Section titled “Channels”All channels are namespaced with brand_protect_cable:.
| Channel | Payload | Rails processor |
|---|---|---|
scan_db_updates |
Scan status + stage progress | process_scan_update |
scan_findings |
Finding batches (initial + deltas) | process_initial_findings / process_findings_deltas |
domain_profiles |
Domain enrichment results | process_domain_profile |
social_profiles |
Social enrichment results | process_social_profile |
social_findings |
Social finding batches | process_initial_social_findings / process_social_findings_deltas |
Consumer
Section titled “Consumer”Rails boots scan_db_consumer (a thread in config/initializers/scan_db_consumer.rb). It subscribes to the channels and dispatches to the processor methods above.
process_scan_update does the heavy lifting on terminal states:
- Merges stage progress into
stage_states. - Broadcasts progress over ActionCable.
- Maintains the
scan:active:<id>key (TTL 1 hour). - On completion: enqueues
ReportGenerationJob+WebhookDeliveryJob, recordsscan_completed/scan_failed/scan_cancelledaudit events.
Configuration
Section titled “Configuration”REDIS_URL (default redis://redis:6379/1) configures the connection on both sides. The compose stack runs Redis with Redis Insight exposed on port 5540 for debugging.