File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -259,8 +259,6 @@ def rate_limit_start_request(
259259 bucket = _get_bucket_key (rate_limit_prefix , rate_limit_params .bucket , shard_i )
260260 pipe .zcount (bucket , "({:f}" .format (now ), "+inf" )
261261
262- historical = - 1
263- concurrent = - 1
264262 try :
265263 results = pipe .execute ()
266264 pipe_results = iter (results )
@@ -283,18 +281,16 @@ def rate_limit_start_request(
283281 # Emit metric for timeout, but don't log since this is expected
284282 # when Redis is slow. We fail open to avoid blocking requests.
285283 metrics .increment ("ratelimiter_redis_timeout" , tags = {"function" : "start_request" })
284+ return RateLimitStats (rate = - 1 , concurrent = - 1 )
286285 except Exception as ex :
287286 # if something goes wrong, we don't want to block the request,
288287 # set the values such that they pass under any limit
289288 logger .exception (ex )
290- finally :
291- if historical == - 1 :
292- return RateLimitStats (rate = - 1 , concurrent = - 1 )
289+ return RateLimitStats (rate = - 1 , concurrent = - 1 )
293290
294291 per_second = historical / float (state .rate_lookback_s )
295292
296- stats = RateLimitStats (rate = per_second , concurrent = concurrent )
297- return stats
293+ return RateLimitStats (rate = per_second , concurrent = concurrent )
298294
299295
300296def rate_limit_finish_request (
You can’t perform that action at this time.
0 commit comments