Method: ActiveRecord::ConnectionAdapters::ConnectionPool#checkin

Defined in:
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb

#checkin(conn) ⇒ Object

Check-in a database connection back into the pool, indicating that you no longer need this connection.

conn: an AbstractAdapter object, which was obtained by earlier by calling #checkout on this pool.



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 573

def checkin(conn)
  return if @pinned_connection.equal?(conn)

  conn.lock.synchronize do
    synchronize do
      connection_lease.clear(conn)

      conn._run_checkin_callbacks do
        conn.expire
      end

      @available.add conn
    end
  end
end