minor: docs

This commit is contained in:
Kyle Banker 2011-02-10 15:13:28 -05:00
parent 04033bf5a3
commit 0d90338a46
2 changed files with 19 additions and 3 deletions

View File

@ -129,7 +129,7 @@ The driver is thread-safe.
## Connection Pooling ## Connection Pooling
As of v0.18, the driver implements connection pooling. By default, only one The driver implements connection pooling. By default, only one
socket connection will be opened to MongoDB. However, if you're running a socket connection will be opened to MongoDB. However, if you're running a
multi-threaded application, you can specify a maximum pool size and a maximum multi-threaded application, you can specify a maximum pool size and a maximum
timeout for waiting for old connections to be released to the pool. timeout for waiting for old connections to be released to the pool.
@ -149,12 +149,24 @@ processes will create a new connection to the database. In Passenger, this can b
if defined?(PhusionPassenger) if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked| PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked if forked
# Create new connection here # Reset all connection objects. How you do this depends on where
# you keep your connection object. In any case, call the #connect
# method on the connection object. For example:
# CONN.connect
#
# If you're using MongoMapper:
# MongoMapper.connection.connect
end end
end end
end end
The above code should be put into a Rails initializer or other initialization script. In Unicorn, add this to your unicorn.rb file:
after_fork do |server, worker|
# Handle reconnection
end
The above code should be put into a Rails initializer or similar initialization script.
## String Encoding ## String Encoding

View File

@ -110,3 +110,7 @@ Without further investigation, it's impossible to know exactly what has caused t
Because of the indeterminacy involved, the MongoDB drivers will not retry operations on connection failure. How connection failures should be handled is entirely dependent on the application. Therefore, we leave it to the application developers to make the best decision in this case. Because of the indeterminacy involved, the MongoDB drivers will not retry operations on connection failure. How connection failures should be handled is entirely dependent on the application. Therefore, we leave it to the application developers to make the best decision in this case.
The drivers will reconnect on the subsequent operation. The drivers will reconnect on the subsequent operation.
#### I ocassionally get an error saying that responses are out of order. What's happening?
See (this JIRA issue)[http://jira.mongodb.org/browse/RUBY-221].