Skip to content

Commit

Permalink
Merge pull request #10598 from nanaya/user-lastvisit-5min
Browse files Browse the repository at this point in the history
 Reduce user last visit recording frequency to 5 minutes
  • Loading branch information
notbakaneko authored Sep 26, 2023
2 parents 36c8b93 + 9b6fe00 commit f2c7ee4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Http/Middleware/UpdateUserLastvisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function handle($request, Closure $next)
}

if (!$isInactive || $isVerified) {
$recordedLastVisit = $user->user_lastvisit;
$currentLastVisit = now();
$recordedLastVisit = $user->getRawAttribute('user_lastvisit');
$currentLastVisit = time();

if ($currentLastVisit->diffInRealSeconds($recordedLastVisit) > 60) {
if ($currentLastVisit - $recordedLastVisit > 300) {
$user->update([
'user_lastvisit' => $currentLastVisit,
], ['skipValidations' => true]);
Expand Down

0 comments on commit f2c7ee4

Please sign in to comment.