Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Bug: fix counter
Browse files Browse the repository at this point in the history
  • Loading branch information
hqy2000 committed Sep 30, 2018
1 parent 4bebfa6 commit e1e354e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Service/CacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public function antiSpiderUse(User $user, int $target) {

public function canSend(string $ip, string $target) {
$current = (int)$this->client->get($this->getIdentifierForCode($ip));
if($current > 5)
if($current >= 5)
return false;
$current ++;
$this->client->set($this->getIdentifierForCode($ip), $current);
$this->client->expire($this->getIdentifierForCode($ip), 1800);

$current = (int)$this->client->get($this->getIdentifierForCode($target));
if($current > 1)
if($current >= 1)
return false;
$current ++;
$this->client->set($this->getIdentifierForCode($target), $current);
Expand Down

0 comments on commit e1e354e

Please sign in to comment.