Module: ActiveRecord::DynamicTimeout::Mysql2AdapterExtension
- Defined in:
- lib/active_record/dynamic_timeout/extensions/mysql2_adapter_extension.rb
Instance Method Summary collapse
- #reset_connection_timeout(raw_connection) ⇒ Object
- #set_connection_timeout(raw_connection, timeout_seconds) ⇒ Object
- #supports_dynamic_timeouts? ⇒ Boolean
- #timeout_set_client_side? ⇒ Boolean
Instance Method Details
#reset_connection_timeout(raw_connection) ⇒ Object
8 9 10 11 12 |
# File 'lib/active_record/dynamic_timeout/extensions/mysql2_adapter_extension.rb', line 8 def reset_connection_timeout(raw_connection) read_timeout = Integer(@config[:read_timeout]) unless @config[:read_timeout].nil? write_timeout = Integer(@config[:write_timeout]) unless @config[:write_timeout].nil? set_timeouts_on_connection(raw_connection, read_timeout:, write_timeout:) end |
#set_connection_timeout(raw_connection, timeout_seconds) ⇒ Object
3 4 5 6 |
# File 'lib/active_record/dynamic_timeout/extensions/mysql2_adapter_extension.rb', line 3 def set_connection_timeout(raw_connection, timeout_seconds) timeout = timeout_seconds.ceil.to_i # Round floats up to the nearest integer set_timeouts_on_connection(raw_connection, read_timeout: timeout, write_timeout: timeout) end |
#supports_dynamic_timeouts? ⇒ Boolean
18 19 20 |
# File 'lib/active_record/dynamic_timeout/extensions/mysql2_adapter_extension.rb', line 18 def supports_dynamic_timeouts? true end |
#timeout_set_client_side? ⇒ Boolean
14 15 16 |
# File 'lib/active_record/dynamic_timeout/extensions/mysql2_adapter_extension.rb', line 14 def timeout_set_client_side? true end |