Class: ScheduleWorkers::RestaurantsExpirationWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/schedule_workers/restaurants_expiration_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/workers/schedule_workers/restaurants_expiration_worker.rb', line 10

def perform
  restaurants_expired_yesterday = fetch_expired_restaurants
  return nil if restaurants_expired_yesterday.blank?

  # Keep restaurant_tags_totals table attribute total_restaurants count up-to-date
  Tagging::SyncRestaurantTagsTotalsTableWorker.perform_async(restaurants_expired_yesterday)

  # Send broadcast to event driven services
  broadcast_to_event_driven_services(restaurants_expired_yesterday)

  # Keep compact_restaurants table up-to-date
  clean_compact_restaurant_cache_for(restaurants_expired_yesterday)

  # Disable E2E and delete Google Reserve packages for expired restaurants
  disable_e2e_for_expired_restaurants(restaurants_expired_yesterday)

  true
rescue StandardError => e
  APMErrorHandler.report e
  raise e
end