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:
587
587
It is easiest to not create any Mongo::Client instances prior to the fork.
588
588
If the parent process needs to perform operations on the MongoDB database,
589
589
reset the client in an ``after_fork`` handler which is defined in
590
- ``unicorn.rb``::
590
+ ``unicorn.rb``:
591
591
592
592
.. code-block:: ruby
593
593
@@ -601,7 +601,7 @@ global variable. It also keeps the MongoDB connection in the parent process
601
601
around, and this connection will continue to consume resources such as
602
602
a connection slot. If the parent process performs one time operation(s) on
603
603
MongoDB 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:
605
605
606
606
.. code-block:: ruby
607
607
@@ -613,6 +613,8 @@ the following code will close the connection in the parent::
613
613
$client.reconnect
614
614
end
615
615
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.
616
618
617
619
Details on Retryable Writes
618
620
---------------------------
You can’t perform that action at this time.
0 commit comments