Class: Vendors::SevenRooms::ReservationInventorySyncWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- Vendors::SevenRooms::ReservationInventorySyncWorker
- Defined in:
- app/workers/vendors/seven_rooms/reservation_inventory_sync_worker.rb
Overview
Worker that triggers inventory sync for sevenrooms when reservations are rejected due to inventory unavailability or when new reservations are created.
Since supplier inventory is synced on a scheduled basis, customers might face booking rejections when inventory data becomes stale. This worker delegates all sync logic to VendorsService::InventorySync::ReservationService, which handles different trigger types, cooldown periods, API rate limiting, and comprehensive logging/monitoring.
Supported trigger types:
-
:inv_mismatch - When inventory mismatches are detected, applies cooldown logic
-
:reservation_created - When new reservations are created, bypasses cooldown for immediate sync
The worker is kept minimal and only acts as a bridge between Sidekiq job processing and the business logic service. All error handling, logging, and APM instrumentation is handled by the service layer.
Instance Method Summary collapse
-
#perform(restaurant_id, date, trigger_type) ⇒ Object
Delegates inventory sync request to the reservation service.
Instance Method Details
#perform(restaurant_id, date, trigger_type) ⇒ Object
Delegates inventory sync request to the reservation service
29 30 31 32 |
# File 'app/workers/vendors/seven_rooms/reservation_inventory_sync_worker.rb', line 29 def perform(restaurant_id, date, trigger_type) service = VendorsService::InventorySync::ReservationService.new(:sevenrooms) service.sync_if_needed(restaurant_id: restaurant_id, date: date, trigger_type: trigger_type.to_sym) end |