Class: Partner::ReservationSummaryBatchSyncWorker

Inherits:
ApplicationWorker show all
Includes:
ElasticAPM::SpanHelpers, Sidekiq::Worker
Defined in:
app/workers/partner/reservation_summary_batch_sync_worker.rb

Constant Summary collapse

MIN_BATCH_SIZE =

Minimum batch size for optimized batch processing

2

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(reservation_ids, sync_type = 'full', batch_info = {}) ⇒ void

Note:

This worker uses the :critical queue with 2 retry attempts

Note:

Individual reservation failures are logged but don't stop batch processing

Note:

Uses single database query to fetch all reservations to avoid N+1 queries

This method returns an undefined value.

Performs batch synchronization of reservation summaries.

Processes multiple reservations in a single job with optimized database queries and comprehensive error handling. Each reservation is processed individually with detailed logging and error tracking.

Parameters:

  • reservation_ids (Array<Integer>)

    Array of reservation IDs to sync

  • sync_type (String) (defaults to: 'full')

    Type of sync operation to perform

    • 'full' (default): Complete sync of all summary data

    • 'loyalty': Sync customer loyalty data only

  • batch_info (Hash) (defaults to: {})

    Optional batch tracking information

Options Hash (batch_info):

  • 'batch_number' (Integer)

    Current batch number for logging

  • 'total_batches' (Integer)

    Total number of batches for progress tracking

Raises:

  • (StandardError)

    Re-raises any unhandled exceptions after logging



50
# File 'app/workers/partner/reservation_summary_batch_sync_worker.rb', line 50

span_method :perform