diff --git a/app/jobs/checkin_job.rb b/app/jobs/checkin_job.rb index 92207d02..d3fa541b 100644 --- a/app/jobs/checkin_job.rb +++ b/app/jobs/checkin_job.rb @@ -3,8 +3,6 @@ class CheckinJob < ActiveJob::Base queue_as :checkin def perform(flight) - sleep(flight.departure_time - 1.day - Time.now) - checkin = Southwest::Checkin.new( names: flight.reservation.passengers.map {|p| { last_name: p[:last_name], first_name: p[:first_name] } diff --git a/app/models/flight.rb b/app/models/flight.rb index 8de88d75..00d984b5 100644 --- a/app/models/flight.rb +++ b/app/models/flight.rb @@ -37,7 +37,7 @@ def scheduled? end def schedule_checkin - schedule_at = departure_time - 1.day - 1.minute + schedule_at = departure_time - 1.day + 1.second job = CheckinJob.set(wait_until: schedule_at).perform_later(self) checkin = Checkin.find_or_initialize_by(flight: self) checkin.update({