instance method
lease
Ruby on Rails 6.0.6
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 218
def lease
if in_use?
msg = +"Cannot lease connection, "
if @owner == Thread.current
msg << "it is already leased by the current thread."
else
msg << "it is already in use by a different thread: #{@owner}. " \
"Current thread: #{Thread.current}."
end
raise ActiveRecordError, msg
end
@owner = Thread.current
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 218
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter