Skip to content

Commit

Permalink
Merge pull request #2510 from emotion-studio/hotfix/nil-exception
Browse files Browse the repository at this point in the history
hotfix: prevent exception in record_one_broadcast_with_new_relic
  • Loading branch information
tannalynn authored Mar 22, 2024
2 parents 4948613 + 9665e9a commit 7aef0a5
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
module NewRelic::Agent::Instrumentation
module ActiveSupportBroadcastLogger
def record_one_broadcast_with_new_relic(*args)
broadcasts[1..-1].each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, true) }
yield
broadcasts.each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, false) }
if broadcasts && broadcasts[1..-1]
broadcasts[1..-1].each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, true) }
yield
broadcasts.each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, false) }
else
NewRelic::Agent.logger.error('Error recording broadcasted logger')
end
end
end
end

0 comments on commit 7aef0a5

Please sign in to comment.