Skip to content

Commit f564950

Browse files
codekitchenccutrer
authored andcommitted
allow skipping request throttling code completely
Change-Id: I1692f384014adf5680f616dc3cffda5069c68a44 Reviewed-on: https://gerrit.instructure.com/48060 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
1 parent e531973 commit f564950

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/canvas/request_throttle.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def call(env)
7777
end
7878

7979
def allowed?(request, bucket)
80+
if Setting.get("request_throttle.skip", "false") == "true"
81+
return true
82+
end
83+
8084
if whitelisted?(request)
8185
return true
8286
elsif blacklisted?(request)
@@ -225,6 +229,11 @@ def cache_key
225229
# expecting the block to return the final cost. It then increments again,
226230
# subtracting the initial up_front_cost from the final cost to erase it.
227231
def reserve_capacity(up_front_cost = self.up_front_cost)
232+
if Setting.get("request_throttle.skip", "false") == "true"
233+
yield
234+
return
235+
end
236+
228237
increment(0, up_front_cost)
229238
cost = yield
230239
ensure

0 commit comments

Comments
 (0)