Class: SeoVisitsSyncWorker
- Inherits:
-
Object
- Object
- SeoVisitsSyncWorker
- Includes:
- Sidekiq::Job, Sidekiq::Status::Worker
- Defined in:
- app/workers/seo_visits_sync_worker.rb
Overview
Dispatches independently retryable, one-day visit aggregate rebuilds. The
child jobs run on a dedicated one-thread heavy-role capsule, so the initial
90-day backfill is bounded and a shutdown resumes at the unfinished day.
Instance Method Summary collapse
Instance Method Details
#perform(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/workers/seo_visits_sync_worker.rb', line 15 def perform( = {}) = .with_indifferent_access period_end = ([:period_end] || Date.current).to_date query = Seo::VisitPageDailyCountsQuery.new(period_end:) refresh_dates = query.refresh_dates if initial_backfill_gated?(refresh_dates, ) total 1 at 1, 'Initial visit aggregate requires an approved bulk-operation rollout' store info_message: 'Visit aggregation deferred: initial backfill approval required' store refresh_days: refresh_dates.size report_event( 'initial_backfill_gated', refresh_days: refresh_dates.size, period_end: period_end.to_s ) return :initial_backfill_gated end total 2 at 1, "Dispatching #{refresh_dates.size} daily visit aggregate(s)..." batch = dispatch_refreshes(refresh_dates, period_end) report_dispatch(batch, refresh_dates, period_end) batch.bid rescue StandardError => e Rails.logger.error("[SeoVisitsSyncWorker] Failed: #{e.}") store info_message: "Visit sync dispatch failed: #{e.}" raise end |