Method: ActiveRecord::ConnectionAdapters::AbstractAdapter#expire
- Defined in:
- lib/active_record/connection_adapters/abstract_adapter.rb
#expire(update_idle = true) ⇒ Object
this method must only be called while holding connection pool's mutex
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/active_record/connection_adapters/abstract_adapter.rb', line 329 def expire(update_idle = true) # :nodoc: if in_use? if @owner != ActiveSupport::IsolatedExecutionState.context raise ActiveRecordError, "Cannot expire connection, " \ "it is owned by a different thread: #{@owner}. " \ "Current thread: #{ActiveSupport::IsolatedExecutionState.context}." end _run_checkin_callbacks do @idle_since = Process.clock_gettime(Process::CLOCK_MONOTONIC) if update_idle @owner = nil enable_lazy_transactions! unset_query_cache! end else raise ActiveRecordError, "Cannot expire connection, it is not currently leased." end end |