From d7a7a8bda5cba232d8d5d300b95cef79d40cc528 Mon Sep 17 00:00:00 2001 From: Sebastian Cohnen Date: Sun, 10 Mar 2024 01:48:11 +0100 Subject: [PATCH] readme: Clarify AS::Notification.subscribe arguments (#654) * fix AS::Notification.subscribe arguments in README.md * event_id -> instrumenter_id --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 545003cc..199021f6 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,7 @@ Rack::Attack.track("special_agent", limit: 6, period: 60) do |req| end # Track it using ActiveSupport::Notification -ActiveSupport::Notifications.subscribe("track.rack_attack") do |name, start, finish, request_id, payload| +ActiveSupport::Notifications.subscribe("track.rack_attack") do |name, start, finish, instrumenter_id, payload| req = payload[:request] if req.env['rack.attack.matched'] == "special_agent" Rails.logger.info "special_agent: #{req.path}" @@ -383,7 +383,7 @@ To get notified about specific type of events, subscribe to the event name follo E.g. for throttles use: ```ruby -ActiveSupport::Notifications.subscribe("throttle.rack_attack") do |name, start, finish, request_id, payload| +ActiveSupport::Notifications.subscribe("throttle.rack_attack") do |name, start, finish, instrumenter_id, payload| # request object available in payload[:request] # Your code here @@ -393,7 +393,7 @@ end If you want to subscribe to every `rack_attack` event, use: ```ruby -ActiveSupport::Notifications.subscribe(/rack_attack/) do |name, start, finish, request_id, payload| +ActiveSupport::Notifications.subscribe(/rack_attack/) do |name, start, finish, instrumenter_id, payload| # request object available in payload[:request] # Your code here