Class: SlavePools::Config
- Inherits:
-
Object
- Object
- SlavePools::Config
- Defined in:
- lib/slave_pools/config.rb
Instance Attribute Summary collapse
-
#defaults_to_master ⇒ Object
When true, all queries will go to master unless wrapped in with_pool{}.
-
#environment ⇒ Object
The current environment.
-
#no_replay_on_master ⇒ Object
enter a list of errors/messages that shouldn’t fall back to master of the form {‘ErrorClass’ => [‘message regex1’, ‘message regex 2’], } Defaults are => [‘Timeout waiting for a response from the last query’].
-
#safe_methods ⇒ Object
The list of methods considered safe to send to a readonly connection.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
21 22 23 24 25 26 |
# File 'lib/slave_pools/config.rb', line 21 def initialize @environment = 'development' @defaults_to_master = false @safe_methods = [] @no_replay_on_master = {} end |
Instance Attribute Details
#defaults_to_master ⇒ Object
When true, all queries will go to master unless wrapped in with_pool{}. When false, all safe queries will go to the current replica unless wrapped in with_master{}. Defaults to false.
10 11 12 |
# File 'lib/slave_pools/config.rb', line 10 def defaults_to_master @defaults_to_master end |
#environment ⇒ Object
The current environment. Normally set to Rails.env, but will default to ‘development’ outside of Rails apps.
5 6 7 |
# File 'lib/slave_pools/config.rb', line 5 def environment @environment end |
#no_replay_on_master ⇒ Object
enter a list of errors/messages that shouldn’t fall back to master of the form {‘ErrorClass’ => [‘message regex1’, ‘message regex 2’], } Defaults are => [‘Timeout waiting for a response from the last query’].
19 20 21 |
# File 'lib/slave_pools/config.rb', line 19 def no_replay_on_master @no_replay_on_master end |
#safe_methods ⇒ Object
The list of methods considered safe to send to a readonly connection. Defaults are based on Rails version.
14 15 16 |
# File 'lib/slave_pools/config.rb', line 14 def safe_methods @safe_methods end |