File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -587,7 +587,7 @@ This is because:
587587It is easiest to not create any Mongo::Client instances prior to the fork.
588588If the parent process needs to perform operations on the MongoDB database,
589589reset the client in an ``after_fork`` handler which is defined in
590- ``unicorn.rb``::
590+ ``unicorn.rb``:
591591
592592.. code-block:: ruby
593593
@@ -601,7 +601,7 @@ global variable. It also keeps the MongoDB connection in the parent process
601601around, and this connection will continue to consume resources such as
602602a connection slot. If the parent process performs one time operation(s) on
603603MongoDB and does not need its MongoDB connection once workers are forked,
604- the following code will close the connection in the parent::
604+ the following code will close the connection in the parent:
605605
606606.. code-block:: ruby
607607
@@ -613,6 +613,8 @@ the following code will close the connection in the parent::
613613 $client.reconnect
614614 end
615615
616+ *Note:* This pattern should be used with Ruby driver version 2.7.0 or higher.
617+ Previous driver versions did not recreate monitoring threads when reconnecting.
616618
617619Details on Retryable Writes
618620---------------------------
You can’t perform that action at this time.
0 commit comments