Module: ActiveRecord::DynamicTimeout::AbstractAdapterExtension
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb
Instance Attribute Summary collapse
-
#active_record_dynamic_timeout ⇒ Object
Returns the value of attribute active_record_dynamic_timeout.
Instance Method Summary collapse
- #reset_dynamic_timeout(raw_connection) ⇒ Object
- #set_dynamic_timeout(raw_connection, timeout_seconds) ⇒ Object
- #supports_dynamic_timeouts? ⇒ Boolean
Instance Attribute Details
#active_record_dynamic_timeout ⇒ Object
Returns the value of attribute active_record_dynamic_timeout.
10 11 12 |
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 10 def active_record_dynamic_timeout @active_record_dynamic_timeout end |
Instance Method Details
#reset_dynamic_timeout(raw_connection) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 31 def reset_dynamic_timeout(raw_connection) if supports_dynamic_timeouts? && active_record_dynamic_timeout reset_connection_timeout(raw_connection) self.active_record_dynamic_timeout = nil end end |
#set_dynamic_timeout(raw_connection, timeout_seconds) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 20 def set_dynamic_timeout(raw_connection, timeout_seconds) if supports_dynamic_timeouts? && timeout_seconds != active_record_dynamic_timeout if timeout_seconds.nil? reset_dynamic_timeout(raw_connection) else set_connection_timeout(raw_connection, timeout_seconds) self.active_record_dynamic_timeout = timeout_seconds end end end |
#supports_dynamic_timeouts? ⇒ Boolean
16 17 18 |
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 16 def supports_dynamic_timeouts? false end |