Don't query the bruteforce attempts when we just deleted them

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-12-01 18:01:22 +01:00
parent 3a1ef2b012
commit 1d550ab95e
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA

View file

@ -66,6 +66,8 @@ class Throttler {
private $logger;
/** @var IConfig */
private $config;
/** @var bool */
private $hasAttemptsDeleted = false;
/**
* @param IDBConnection $db
@ -230,7 +232,7 @@ class Throttler {
$maxAgeHours = 48;
}
if ($ip === '') {
if ($ip === '' || $this->hasAttemptsDeleted) {
return 0;
}
@ -306,7 +308,9 @@ class Throttler {
->andWhere($qb->expr()->eq('action', $qb->createNamedParameter($action)))
->andWhere($qb->expr()->eq('metadata', $qb->createNamedParameter(json_encode($metadata))));
$qb->execute();
$qb->executeStatement();
$this->hasAttemptsDeleted = true;
}
/**