From e937a82ccbc07254fbea9fa00732fa38f8fd06f9 Mon Sep 17 00:00:00 2001 From: Santiago Bartesaghi Date: Fri, 27 Oct 2023 15:00:23 -0300 Subject: [PATCH] Minor refactoring --- 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 69923393..0ec5f7aa 100644 --- a/lib/rack/attack/throttle.rb +++ b/lib/rack/attack/throttle.rb @@ -38,8 +38,9 @@ def matched_by?(request) 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)