evazion
4492610dfe
rate limits: rework rate limit implementation.
...
Rework the rate limit implementation to make it more flexible:
* Allow setting different rate limits for different actions. Before we
had a single rate limit for all write actions. Now different
controller endpoints can have different limits.
* Allow actions to be rate limited by user ID, by IP address, or both.
Before actions were only limited by user ID, which meant non-logged-in
actions like creating new accounts or attempting to login couldn't be rate
limited. Also, because actions were limited by user ID only, you could
use multiple accounts with the same IP to get around limits.
Other changes:
* Remove the API Limit field from user profile pages.
* Remove the `remaining_api_limit` field from the `/profile.json` endpoint.
* Rename the `X-Api-Limit` header to `X-Rate-Limit` and change it from a
number to a JSON object containing all the rate limit info
(including the refill rate, the burst factor, the cost of the call,
and the current limits).
* Fix a potential race condition where, if you flooded requests fast
enough, you could exceed the rate limit. This was because we checked
and updated the rate limit in two separate steps, which was racy;
simultaneous requests could pass the check before the update happened.
The new code uses some tricky SQL to check and update multiple limits
in a single statement.
2021-03-05 16:00:54 -06:00
..
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2020-03-18 03:32:40 -05:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2021-03-05 16:00:54 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-06 18:09:57 -07:00
2019-12-22 21:23:37 -06:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-26 15:31:06 -07:00
2018-04-06 18:09:57 -07:00
2018-04-26 15:31:06 -07:00
2018-04-25 14:31:11 -07:00
2018-05-16 16:04:05 -07:00
2018-06-14 17:52:41 -07:00
2018-06-14 17:52:41 -07:00
2018-08-04 16:32:15 -07:00
2018-08-24 12:10:51 -07:00
2018-09-12 15:19:27 -07:00
2018-09-13 11:44:11 -07:00
2019-12-22 21:23:37 -06:00
2018-11-08 15:09:31 -06:00
2018-11-08 14:24:45 -08:00
2018-11-13 19:18:11 -06:00
2018-12-10 17:51:57 -08:00
2018-12-10 17:51:57 -08:00
2018-11-28 13:55:02 -08:00
2018-11-29 16:51:46 -08:00
2018-12-02 11:45:57 -06:00
2019-01-09 16:20:34 -06:00
2019-01-28 17:23:33 -08:00
2019-07-12 10:48:48 -07:00
2019-08-27 18:13:30 -05:00
2019-08-27 18:13:30 -05:00
2019-08-27 18:45:40 -05:00
2019-08-27 18:48:48 -05:00
2019-08-27 19:58:05 -05:00
2019-08-29 00:52:23 -05:00
2019-08-29 02:06:35 -05:00
2019-09-02 18:53:27 -05:00
2019-09-07 22:21:55 -05:00
2019-09-07 23:06:20 -05:00
2019-09-19 13:20:06 -05:00
2019-09-23 02:22:54 -05:00
2019-09-25 21:43:01 -05:00
2019-10-23 21:36:48 -05:00
2019-10-24 19:48:30 -05:00
2019-11-11 21:03:07 -06:00
2019-11-11 21:03:07 -06:00
2019-11-15 22:44:13 -06:00
2019-11-15 22:44:22 -06:00
2019-11-16 19:34:30 -06:00
2019-11-17 01:52:36 -06:00
2019-11-17 02:10:24 -06:00
2019-11-17 02:45:28 -06:00
2019-11-17 14:39:41 -06:00
2019-11-19 00:13:24 -06:00
2019-12-23 00:02:54 -06:00
2020-01-16 21:40:14 +00:00
2020-01-17 00:19:20 -06:00
2020-01-18 06:40:20 +00:00
2020-01-17 22:24:29 -06:00
2020-01-21 00:10:20 -06:00
2020-01-21 00:10:21 -06:00
2020-01-27 00:47:35 -06:00
2020-02-16 23:09:00 -06:00
2020-02-22 22:37:36 -06:00
2020-02-23 17:52:38 -06:00
2020-03-06 14:50:21 -06:00
2020-03-06 23:23:38 -06:00
2020-03-08 23:18:15 -05:00
2020-03-12 21:18:53 -05:00
2020-03-20 16:08:20 -05:00
2020-03-25 18:48:21 -05:00
2020-03-25 18:48:42 -05:00
2020-04-03 23:44:02 -05:00
2020-04-06 14:13:22 -05:00
2020-04-27 19:11:47 -05:00
2020-08-06 20:55:45 -05:00
2020-08-16 14:31:47 -05:00
2020-12-01 18:58:45 -06:00
2020-12-13 04:10:48 -06:00
2020-12-19 14:26:07 -06:00
2020-12-24 21:15:04 -06:00
2021-01-06 16:05:56 -06:00
2021-01-08 22:34:37 -06:00
2021-01-08 22:34:37 -06:00
2021-01-08 22:34:37 -06:00
2021-01-12 13:12:33 -06:00
2021-01-10 03:35:12 -06:00
2021-01-15 02:03:54 -06:00
2021-01-23 14:44:11 -06:00
2021-01-26 19:19:20 -06:00
2021-01-26 19:24:18 -06:00
2021-02-14 04:09:47 -06:00
2021-02-14 21:02:07 -06:00
2021-03-05 16:00:54 -06:00