Class: ScheduleWorkers::OccupancyExportWorker

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

Overview

There is a cronjob that triggers this worker every day at 2am This worker spawns individual occupancy export jobs for each active restaurant app/workers/schedule_workers/occupancy_restaurant_export_worker.rb To run individual restaurant export jobs in parallel

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(timestamp = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/workers/schedule_workers/occupancy_export_worker.rb', line 11

def perform(timestamp = nil)
  timestamp ||= Time.current.to_i

  BUSINESS_LOGGER.info('Starting occupancy export job', {
                         timestamp: timestamp,
                         total_restaurants: total_restaurant_count,
                       })

  jobs_spawned = spawn_restaurant_export_jobs(timestamp)

  BUSINESS_LOGGER.info('Parallel occupancy export jobs spawned successfully', {
                         timestamp: timestamp,
                         total_restaurants: total_restaurant_count,
                         jobs_spawned: jobs_spawned,
                       })
end