Changing caching parameters, fix checkin dates
This commit is contained in:
parent
61d5f69699
commit
ee75bc6976
2 changed files with 4 additions and 4 deletions
|
@ -15,8 +15,8 @@ Route::get('/{tripId?}', function (Request $request, $tripId = null) {
|
|||
$viewMode = $request->input('show', null);
|
||||
|
||||
/*
|
||||
* If there is a file in the local cache that is less than 3 hours old,
|
||||
* use that.
|
||||
* If there is a file in the local cache that is less than 1–3 hours old
|
||||
* (depending on whether it was actively tracking at last check), use that.
|
||||
*/
|
||||
$tripFileName = ( $tripId ?? config('app.current_trip_id') ) . '.json';
|
||||
if (Storage::disk('local')->exists($tripFileName)) {
|
||||
|
@ -24,7 +24,7 @@ Route::get('/{tripId?}', function (Request $request, $tripId = null) {
|
|||
if ($cachedData->trip->is_active) {
|
||||
$cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at);
|
||||
$now = new DateTime();
|
||||
if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= 3) {
|
||||
if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= ($cachedData->trip->is_tracking) ? 1 : 3) {
|
||||
return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($viewMode === 'all')]);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue