Skip to content

Commit 48a3337

Browse files
committed
Clean up the custom rate limit doc.
1 parent 0b950ca commit 48a3337

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

doc/rest.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,12 +1192,14 @@ Adding other endpoints (e.g. to allow an OPTIONS query against
11921192
Creating Custom Rate Limits
11931193
===========================
11941194

1195-
Using the file ``interfaces.py`` in the tracker home directory, you
1196-
can replace the rate limiter function. This lets you return a
1197-
different rate limiter rather then the one that is provided in the
1198-
rate_limiter.py file. If you add a ``rate_limit_interval`` and
1199-
``rate_limit_calls`` as integers in the user object you can do
1200-
something like this in interfaces.py::
1195+
You can replace the default rate limiter that is configured using
1196+
the tracker's ``config.ini``. You can return different rate
1197+
limits based on the user, time of day, phase of moon etc.
1198+
1199+
Assume you add two integer valued properties to the user
1200+
object. Let's call them ``rate_limit_interval`` and
1201+
``rate_limit_calls``. Add code similar to this to interfaces.py
1202+
to override the default rate limiter code::
12011203

12021204
from roundup.rest import RestfulInstance, RateLimit
12031205
from datetime import timedelta
@@ -1225,9 +1227,10 @@ something like this in interfaces.py::
12251227

12261228
RestfulInstance.getRateLimit = grl
12271229

1228-
this should replace the default getRateLimit with the new grl function
1229-
that looks for per user values for the number of calls and period.
1230-
If either is set to 0, the defaults from ``config.ini`` file are used.
1230+
this should replace the default getRateLimit with the new grl
1231+
function. This new function uses values for the number of calls
1232+
and period that are specific to a user. If either is set to 0,
1233+
the defaults from ``config.ini`` file are used.
12311234

12321235
Test Examples
12331236
=============

0 commit comments

Comments
 (0)