Class: SeoAhrefsSyncWorker
- Inherits:
-
Object
- Object
- SeoAhrefsSyncWorker
- Includes:
- Sidekiq::Status::Worker, Sidekiq::Worker
- Defined in:
- app/workers/seo_ahrefs_sync_worker.rb
Overview
Syncs SUPPLEMENTARY SEO metrics from Ahrefs.
Provides keyword positions, backlinks, and estimated traffic data.
NOTE: Ahrefs is NOT the primary driver for "which pages matter" - that comes from
first-party data (Visits, GSC, GA4). Ahrefs adds keyword/backlink context.
Ahrefs has API rate limits, so this runs after the first-party syncs.
Updates: seo_traffic, seo_keywords_count, seo_top_keyword, seo_top_position, seo_traffic_value
Scheduled nightly at 2:30 AM CT via sidekiq_production_schedule.yml
Instance Method Summary collapse
Instance Method Details
#perform(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/workers/seo_ahrefs_sync_worker.rb', line 20 def perform( = {}) = .with_indifferent_access total 2 at 1, 'Syncing Ahrefs metrics...' result = Seo::AhrefsSyncService.new(.slice(:limit)).process at 2, 'Complete' store info_message: "Ahrefs: #{result[:pages_updated]} pages updated" store pages_updated: result[:pages_updated] store errors: result[:errors] Rails.logger.info "[SeoAhrefsSyncWorker] Completed: #{result[:pages_updated]} pages" rescue StandardError => e Rails.logger.error "[SeoAhrefsSyncWorker] Failed: #{e.}" store info_message: "Ahrefs sync failed: #{e.}" raise end |