Skip to content

Commit b1004a4

Browse files
akxadamchainz
andauthored
docs: Add a note on concurrency and races (#6950)
Refs #5181 Co-authored-by: Adam Johnson <me@adamj.eu>
1 parent 86673a3 commit b1004a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/api-guide/throttling.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ If you need to use a cache other than `'default'`, you can do so by creating a c
106106

107107
You'll need to remember to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.
108108

109+
## A note on concurrency
110+
111+
The built-in throttle implementations are open to [race conditions][race], so under high concurrency they may allow a few extra requests through.
112+
113+
If your project relies on guaranteeing the number of requests during concurrent requests, you will need to implement your own throttle class. See [issue #5181][gh5181] for more details.
114+
109115
---
110116

111117
# API Reference
@@ -214,3 +220,5 @@ The following is an example of a rate throttle, that will randomly throttle 1 in
214220
[identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster
215221
[cache-setting]: https://docs.djangoproject.com/en/stable/ref/settings/#caches
216222
[cache-docs]: https://docs.djangoproject.com/en/stable/topics/cache/#setting-up-the-cache
223+
[gh5181]: https://github.com/encode/django-rest-framework/issues/5181
224+
[race]: https://en.wikipedia.org/wiki/Race_condition#Data_race

0 commit comments

Comments
 (0)