Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloudflare
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
cloudflare
Commits
4adb59b8
Verified
Commit
4adb59b8
authored
1 year ago
by
scambler
Committed by
Kirill Roskolii
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3345170
by scambler: Rate limit check - confusing messaging
parent
e4a83fbf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/cloudflarepurger/src/Plugin/Purge/DiagnosticCheck/ApiRateLimitCheck.php
+6
-6
6 additions, 6 deletions
...er/src/Plugin/Purge/DiagnosticCheck/ApiRateLimitCheck.php
with
6 additions
and
6 deletions
modules/cloudflarepurger/src/Plugin/Purge/DiagnosticCheck/ApiRateLimitCheck.php
+
6
−
6
View file @
4adb59b8
...
...
@@ -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/
#reques
ts
* @see https://
developers
.cloudflare.com/
fundamentals/api/reference/limi
ts
/
*
* @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 A
pi
limit of
:$
rate_count/
:
rate_limit
limit purges/day
.'
,
$message_variables
);
$this
->
recommendation
=
$this
->
t
(
'Exceeded A
PI
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 A
pi
limit of
:$
rate_count/
:
rate_limit
limit purges/day
.'
,
$message_variables
);
$this
->
recommendation
=
$this
->
t
(
'Approaching A
PI
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
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment