Module: ActiveRecord::DynamicTimeout::TimeoutAdapterExtension_Rails_7_0

Defined in:
lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb

Instance Method Summary collapse

Instance Method Details

#configure_connectionObject

This ensures new connections from reconnects have the correct timeout.



81
82
83
84
85
86
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 81

def configure_connection
  super
  if supports_dynamic_timeouts? && active_record_dynamic_timeout
    set_connection_timeout(@connection, active_record_dynamic_timeout)
  end
end

#log(*args, **kwargs, &block) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 69

def log(*args, **kwargs, &block)
  super do
    set_dynamic_timeout(@connection, ActiveRecord::Base.current_timeout_seconds)
    yield
  ensure
    if timeout_set_client_side?
      reset_dynamic_timeout(@connection)
    end
  end
end

#reset_dynamic_timeout_for_checkinObject



88
89
90
91
92
# File 'lib/active_record/dynamic_timeout/extensions/abstract_adapter_extension.rb', line 88

def reset_dynamic_timeout_for_checkin
  if @connection
    reset_dynamic_timeout(@connection)
  end
end