Skip to content

Commit

Permalink
- TresholdsGovernor::packData bug fixed: now uses keepCountsFor param…
Browse files Browse the repository at this point in the history
…eter,

    now returns array with until when each type of data was deleted
  • Loading branch information
metaclass-nl committed Jul 23, 2014
1 parent fc584d7 commit 4399913
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ AuthenticationGuardBundle Issue #6 Add a function for clean-up of the RequestCou
::insertOrIncrementFailureCount $rejection parameter added
- DbalGateway::insertOrIncrementCount, ::incrementCountWhereId, ::createRequestCountsWith
parameter $blockedCounterName added
comitted, not pushed.
(blocked columns and statistics need tests and documentation,
statistics UI need refactoring from UserBundle)
comitted, pushed.
-----------------------------------------------------------
- TresholdsGovernor::packData bug fixed: now uses keepCountsFor parameter,
now returns array with until when each type of data was deleted

---------------------------------------------------------
(blocked columns and statistics need tests and documentation,
statistics UI need refactoring from UserBundle)
8 changes: 6 additions & 2 deletions src/Metaclass/TresholdsGovernor/Service/TresholdsGovernor.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,21 @@ public function adminReleaseIpAddress()
* Packing RequestCounts into ones with longer durations has not yet been implemented. */
public function packData()
{
$this->requestCountsManager->deleteCountsUntil($this->getMinBlockingLimit());
$limit = new \DateTime("$this->dtString - $this->keepCountsFor");
$this->requestCountsManager->deleteCountsUntil($limit);
$result["requestcounts_deleted_until"] = $limit;
//idea pack RequestCounts to lower granularity for period between both limits

$limit = new \DateTime($this->dtString);
if ($this->allowReleasedUserOnAddressFor) {
$limit = min($limit, new \DateTime("$this->dtString - $this->allowReleasedUserOnAddressFor"));
}
if ($this->allowReleasedUserByCookieFor) {
$limit = min($limit, new \DateTime("$this->dtString - $this->allowReleasedUserByCookieFor"));
}
$this->releasesManager->deleteReleasesUntil($limit);
$result["releases_deleted_until"] = $limit;

return $result;
}

public function getMinBlockingLimit()
Expand Down

0 comments on commit 4399913

Please sign in to comment.