mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
checkMinInterval use last_action
This commit is contained in:
@@ -423,12 +423,16 @@ class TrackerRepository extends BaseRepository
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($peer) {
|
if ($peer) {
|
||||||
|
$lastAction = $peer->last_action;
|
||||||
|
$isLastActionValidDate = $peer->isValidDate('last_action');
|
||||||
|
$diffInSeconds = Carbon::now()->diffInSeconds($peer->last_action);
|
||||||
|
$min = self::MIN_ANNOUNCE_WAIT_SECOND;
|
||||||
do_log(sprintf(
|
do_log(sprintf(
|
||||||
'event: %s, prev_action: %s, isValidDate: %s, diffInSeconds: %s',
|
'event: %s, last_action: %s, isLastActionValidDate: %s, diffInSeconds: %s',
|
||||||
$queries['event'], $peer->prev_action, var_export($peer->isValidDate('prev_action'), true), Carbon::now()->diffInSeconds($peer->prev_action)
|
$queries['event'], $lastAction, var_export($isLastActionValidDate, true), $diffInSeconds
|
||||||
));
|
));
|
||||||
if ($queries['event'] == '' && $peer->isValidDate('prev_action') && Carbon::now()->diffInSeconds($peer->prev_action) < self::MIN_ANNOUNCE_WAIT_SECOND) {
|
if ($queries['event'] == '' && $isLastActionValidDate && $diffInSeconds < $min) {
|
||||||
throw new TrackerException('There is a minimum announce time of ' . self::MIN_ANNOUNCE_WAIT_SECOND . ' seconds');
|
throw new TrackerException('There is a minimum announce time of ' . $min . ' seconds');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $peer;
|
return $peer;
|
||||||
|
|||||||
Reference in New Issue
Block a user