Module: Octoball::LogSubscriber

Defined in:
lib/octoball/log_subscriber.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_shardObject

Returns the value of attribute current_shard.



4
5
6
# File 'lib/octoball/log_subscriber.rb', line 4

def current_shard
  @current_shard
end

Instance Method Details

#sql(event) ⇒ Object



6
7
8
9
10
# File 'lib/octoball/log_subscriber.rb', line 6

def sql(event)
  shard = event.payload[:connection]&.current_shard
  self.current_shard = shard == ActiveRecord::Base.default_shard ? nil : shard
  super
end