Method: Mongo::Server::ConnectionPool#populate
- Defined in:
- lib/mongo/server/connection_pool.rb
#populate ⇒ true | false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method does three things:
-
Creates and adds a connection to the pool, if the pool’s size is below min_size. Retries once if a socket-related error is encountered during this process and raises if a second error or a non socket-related error occurs.
-
Removes stale connections from the connection pool.
-
Interrupts connections marked for interruption.
Used by the pool populator background thread.
occured, or the non socket-related error
793 794 795 796 797 798 799 800 801 802 803 804 805 |
# File 'lib/mongo/server/connection_pool.rb', line 793 def populate return false if closed? begin return create_and_add_connection rescue Error::SocketError, Error::SocketTimeoutError => e # an error was encountered while connecting the connection, # ignore this first error and try again. log_warn("Populator failed to connect a connection for #{address}: #{e.class}: #{e}. It will retry.") end return create_and_add_connection end |