Skip to content

Commit

Permalink
Refer connection payload in addition to connection_id (#367)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuu Yamanoi <[email protected]>
  • Loading branch information
mlarraz and yyamanoi1222 authored Jun 23, 2023
1 parent 9d27da2 commit ee22087
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/makara/logging/subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ def sql(event)
### [Primary|Replica] User Load (1.3ms) SELECT * FROM `users`;
###
def current_wrapper_name(event)
connection = event.payload[:connection]
connection_object_id = event.payload[:connection_id]
return nil unless connection_object_id
return nil unless connection || connection_object_id

adapter = ObjectSpace._id2ref(connection_object_id)
adapter = connection || ObjectSpace._id2ref(connection_object_id)

return nil unless adapter
return nil unless adapter.respond_to?(:_makara_name)
Expand Down

0 comments on commit ee22087

Please sign in to comment.