Class: ScheduleWorkers::GoogleReserve::AvailabilityFeedsWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- ScheduleWorkers::GoogleReserve::AvailabilityFeedsWorker
- Includes:
- ElasticAPM::SpanHelpers
- Defined in:
- app/workers/schedule_workers/google_reserve/availability_feeds_worker.rb
Instance Method Summary collapse
-
#perform(mode = 'schedule', restaurant_ids = nil, shard_number = 0, generation_timestamp = nil, retry_count = 0) ⇒ void
Main entry point for the availability feed generation process Supports three modes of operation: - 'schedule': Deletes all existing data and initiates the distributed processing - 'process': Processes a single restaurant (restaurant_ids is single integer) - 'upload': Aggregates and uploads a single shard feed (restaurant_ids is array, shard_number required).
Instance Method Details
#perform(mode = 'schedule', restaurant_ids = nil, shard_number = 0, generation_timestamp = nil, retry_count = 0) ⇒ void
This method returns an undefined value.
Main entry point for the availability feed generation process Supports three modes of operation:
-
'schedule': Deletes all existing data and initiates the distributed processing
-
'process': Processes a single restaurant (restaurant_ids is single integer)
-
'upload': Aggregates and uploads a single shard feed (restaurant_ids is array, shard_number required)
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/workers/schedule_workers/google_reserve/availability_feeds_worker.rb', line 44 def perform(mode = 'schedule', restaurant_ids = nil, shard_number = 0, = nil, retry_count = 0) return unless Flipper.enabled?(:google_reserve_e2e) case mode when 'schedule' VendorsService::GoogleReserve::AvailabilityFeeds::SchedulerService.new.call when 'process' # For process mode, restaurant_ids is a single integer (restaurant_id) # Extract first element if array is passed (for safety), otherwise use as-is restaurant_id = restaurant_ids.is_a?(Array) ? restaurant_ids.first : restaurant_ids VendorsService::GoogleReserve::AvailabilityFeeds::ProcessorService.new(restaurant_id).call when 'upload' # For upload mode, restaurant_ids must be an array of integers VendorsService::GoogleReserve::AvailabilityFeeds::UploaderService.new( restaurant_ids, shard_number, , retry_count, ).call else APMErrorHandler.report("#{self.class}: Unknown mode: #{mode}") end end |