@@ -599,16 +599,18 @@ response data is drained and the connection is ready to send the next command.
599
599
check if at least one byte can be read/received. If at least one byte can be read the timestamp must be updated and
600
600
connection SHOULD be drained. If no bytes can be read, the connection MUST be closed.
601
601
3 . ** User-provided timeout** : If a user-provided timeout is specified for the operation, the driver MUST use the minimum
602
- of (a) the remaining time before the 3 second "pending response" window elapses and (b) the user-provided timeout
603
- as the effective timeout for the draining.
602
+ of (a) the remaining time before the 3 second "pending response" window elapses and (b) the remaining of
603
+ user-provided timeout as the effective timeout for the draining.
604
604
4 . ** Default timeout** : If no user-provided timeout is specified, the driver MUST use the minimum of (a) the remaining 3
605
- second "pending response" window and (b) the ` socketTimeoutMS ` (if supported by the driver) as the effective
606
- timeout for the draining.
607
- 5 . ** Error or over-age** : If any error other than timeout occurs while draining the pending response, or if the draining
605
+ second "pending response" window and (b) the ` waitQueueTimeoutMS ` (if not supported by the driver remaining of
606
+ ` serverSelectionTimeoutMS ` should be used instead) as the effective timeout for the draining.
607
+ 5 . ** On Timeout** : if timeout occurred while draining the pending response and the 3 seconds pending-response window was
608
+ not elapsed, Driver SHOULD return the connection to the pool, so the next operation can continue draining of the
609
+ pending response.
610
+ 6 . ** Error or over-age** : If any error other than timeout occurs while draining the pending response, or if the draining
608
611
exceeds the 3 seconds pending-response window, the driver MUST close the connection. Driver SHOULD try to make
609
- another checkout attempt if timeout is not reached yet or create a new connection according to the Checking Out a
610
- Connection behavior.
611
- 6 . ** Clear pending state on success** : If the pending response is fully drained, the pending response state MUST be
612
+ another checkout attempt accordingly to the Checking Out a Connection behavior.
613
+ 7 . ** Clear pending state on success** : If the pending response is fully drained, the pending response state MUST be
612
614
cleared and connection can be used to execute the next command.
613
615
614
616
``` mermaid
@@ -653,12 +655,11 @@ sequenceDiagram
653
655
end
654
656
```
655
657
656
- ```` text
657
658
##### Pseudocode
658
659
659
660
This subsection outlines the pseudocode steps for acquiring a connection from the pool.
660
661
661
- ```python
662
+ ``` text
662
663
connection = Null
663
664
tConnectionCheckOutStarted = current instant (use a monotonic clock if possible)
664
665
emit ConnectionCheckOutStartedEvent and equivalent log message
677
678
if connection is in "pending response" state:
678
679
drain the pending response
679
680
if error:
680
- if non-timeout error:
681
- close connection
681
+ if non-timeout error:
682
+ close connection
682
683
connection = Null
683
684
else if timeout error and last read timestamp on connection > 3 seconds old
684
685
close connection
@@ -739,7 +740,7 @@ do asynchronously:
739
740
tConnectionCheckedOut = current instant (use a monotonic clock if possible)
740
741
emit ConnectionCheckedOutEvent(duration = tConnectionCheckedOut - tConnectionCheckOutStarted) and equivalent log message
741
742
return connection
742
- ````
743
+ ```
743
744
744
745
#### Checking In a Connection
745
746
0 commit comments