Skip to content

Commit

Permalink
Implement reset of rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
verifiednetwork committed Mar 17, 2016
1 parent d5caf1f commit 60b510b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions EventListener/RateLimitAnnotationListener.php
Expand Up @@ -87,6 +87,11 @@ public function onKernelController(FilterControllerEvent $event)
$request = $event->getRequest();
$request->attributes->set('rate_limit_info', $rateLimitInfo);

// Reset the rate limits
if(time() >= $rateLimitInfo->getResetTimestamp()) {
$this->rateLimitService->resetRate($key);
}

// When we exceeded our limit, return a custom error response
if ($rateLimitInfo->getCalls() > $rateLimitInfo->getLimit()) {

Expand Down

0 comments on commit 60b510b

Please sign in to comment.