Skip to content
Snippets Groups Projects
Verified Commit 4adb59b8 authored by scambler's avatar scambler Committed by Kirill Roskolii
Browse files

Issue #3345170 by scambler: Rate limit check - confusing messaging

parent e4a83fbf
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* CloudFlare currently has a rate limit of 1200 Api calls every 5 minutes.
*
* @see https://api.cloudflare.com/#requests
* @see https://developers.cloudflare.com/fundamentals/api/reference/limits/
*
* @PurgeDiagnosticCheck(
* id = "cloudflare_api_rate_limit_check",
......@@ -92,22 +92,22 @@ class ApiRateLimitCheck extends DiagnosticCheckBase implements DiagnosticCheckIn
$daily_warning_level = .75 * self::API_RATE_LIMIT;
$message_variables = [
':rate_limit' => self::API_RATE_LIMIT,
':$rate_count' => $rate_count,
'@rate_limit' => self::API_RATE_LIMIT,
'@rate_count' => $rate_count,
];
if ($rate_count >= self::API_RATE_LIMIT) {
$this->recommendation = $this->t('Exceeded Api limit of :$rate_count/:rate_limit limit purges/day.', $message_variables);
$this->recommendation = $this->t('Exceeded API limit of @rate_count/@rate_limit every 5 minutes.', $message_variables);
return self::SEVERITY_ERROR;
}
elseif ($rate_count >= $daily_warning_level) {
$this->recommendation = $this->t('Approaching Api limit of :$rate_count/:rate_limit limit purges/day.', $message_variables);
$this->recommendation = $this->t('Approaching API limit of @rate_count/@rate_limit every 5 minutes.', $message_variables);
return self::SEVERITY_WARNING;
}
elseif ($rate_count < $daily_warning_level) {
$this->recommendation = $this->t('Site is safely below the rate limit of :rate_limit every 5 minutes.', $message_variables);
$this->recommendation = $this->t('Site is safely below ( @rate_count ) the rate limit of @rate_limit every 5 minutes.', $message_variables);
return self::SEVERITY_OK;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment