closes CNVS-8135
This essentially adds a cost to making multiple requests in parallel, by
adding to the bucket at the beginning of each request, and then
decrementing by the same amount when the request completes.
This way we will now throttle a user who makes many parallel requests,
none of which complete.
test plan:
* The regression portion: ensure that user throttling still works as
before outside of this new use case.
* To test this new use case, it'd be useful to have a request that takes
a very long time to finish. You could modify a controller action like
users#user_dashboard and add a sleep(1000) to the beginning. Then make
enough requests in parallel, all of which will hang on the sleep, so
that you get a 403 error. This will require quite a few rails
processes, of course. You can help that along by increasing
Setting.set('request_throttle.up_front_cost', '500') , then you'll
only need two requests in parallel to hit the limit.
Change-Id: I89412b7b325eef512ba77f21373ec5d9964c86cf
Reviewed-on: https://gerrit.instructure.com/24437
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>