Class: ScheduleWorkers::EventDriven::ExpirationEvents::ExpiredComemorePaylessWorker

Inherits:
ApplicationWorker
  • Object
show all
Defined in:
app/workers/schedule_workers/event_driven/expiration_events/expired_comemore_payless_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#performObject

Performs the daily expiration check for the “Come More Pay Less” promotion. This worker runs every day at 00:00 (midnight) and checks for pricing groups that have expired (where the end_date is yesterday) in the Asia/Bangkok time zone.

For each expired pricing group, it processes the expiration to ensure that the data is synchronized between the hh-server and hh-search.

Logs any errors that occur during the processing of expired pricing groups to Rollbar.



18
19
20
21
22
23
24
25
26
27
# File 'app/workers/schedule_workers/event_driven/expiration_events/expired_comemore_payless_worker.rb', line 18

def perform
  yesterday = Time.use_zone('Asia/Bangkok') { Time.zone.yesterday }
  expired_pricing_groups = HhPackage::PricingGroup.where('end_date = ?', yesterday)

  expired_pricing_groups.each do |expired_pg|
    process_expired_pricing_group(expired_pg)
  end
rescue StandardError => e
  APMErrorHandler.report(e)
end