Class: ShardHandler::ThreadRegistry Private

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::PerThreadRegistry
Defined in:
lib/shard_handler/thread_registry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is used as a registry for the shard name that is being used in the current thread. Because ActiveRecord’s connections are global in the thread scope, we need to make sure that the shard name is changed only for the current thread and not on process or other threads.

See Also:

  • ActiveSupport::PerThreadRegistry

Instance Attribute Summary collapse

Instance Attribute Details

#current_shardObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/shard_handler/thread_registry.rb', line 13

def current_shard
  @current_shard
end