From ffc210250f4fc7e494671068396d6b1b1db3db6c Mon Sep 17 00:00:00 2001 From: Santiago Bartesaghi Date: Fri, 27 Oct 2023 21:46:07 -0300 Subject: [PATCH] refactor: minor refactoring (#635) --- lib/rack/attack/throttle.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rack/attack/throttle.rb b/lib/rack/attack/throttle.rb index 6992339..0ec5f7a 100644 --- a/lib/rack/attack/throttle.rb +++ b/lib/rack/attack/throttle.rb @@ -38,8 +38,9 @@ module Rack epoch_time: cache.last_epoch_time } + annotate_request_with_throttle_data(request, data) + (count > current_limit).tap do |throttled| - annotate_request_with_throttle_data(request, data) if throttled annotate_request_with_matched_data(request, data) Rack::Attack.instrument(request)