Skip to content

Commit

Permalink
Fix import during flight cron #532 (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio authored Feb 1, 2020
1 parent 8cde3c9 commit 893e28e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Cron/Hourly/RemoveExpiredLiveFlights.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Enums\PirepState;
use App\Models\Pirep;
use Carbon\Carbon;

Expand All @@ -13,7 +14,7 @@
class RemoveExpiredLiveFlights extends Listener
{
/**
* Remove expired live flights
* Remove expired live flights that haven't had an update in the live time
*
* @param CronHourly $event
*
Expand All @@ -26,7 +27,7 @@ public function handle(CronHourly $event): void
}

$date = Carbon::now()->subHours(setting('acars.live_time'));
Pirep::whereDate('created_at', '<', $date)
Pirep::whereDate('updated_at', '<', $date)
->where('state', PirepState::IN_PROGRESS)
->delete();
}
Expand Down

0 comments on commit 893e28e

Please sign in to comment.