instance method
lease
Ruby on Rails 8.0.4
Since v3.2.22.5Signature
lease()
this method must only be called while holding connection pool’s mutex
Source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 269
def lease
if in_use?
msg = +"Cannot lease connection, "
if @owner == ActiveSupport::IsolatedExecutionState.context
msg << "it is already leased by the current thread."
else
msg << "it is already in use by a different thread: #{@owner}. " \
"Current thread: #{ActiveSupport::IsolatedExecutionState.context}."
end
raise ActiveRecordError, msg
end
@owner = ActiveSupport::IsolatedExecutionState.context
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 269
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter