Skip to content

Commit becb8c4

Browse files
authored
Fix spec pseudocode for retryable reads (#1896)
1 parent 44176c1 commit becb8c4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

source/retryable-reads/retryable-reads.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ function executeRetryableRead(command, session) {
321321
if (timeoutMS != null && isExpired(timeoutMS) {
322322
throw previousError;
323323
}
324+
/* CSOT is not enabled, and we have already tried once */
325+
if (timeoutMS == null && retrying) {
326+
throw previousError;
327+
}
324328
continue;
325329
}
326330

@@ -359,6 +363,12 @@ function executeRetryableRead(command, session) {
359363
updateTopologyDescriptionForNotWritablePrimaryError(server, notPrimaryError);
360364
previousError = notPrimaryError;
361365
previousServer = server;
366+
} catch (Exception error when error.code in RETRYABLE_ERROR_CODES) {
367+
/* Catches remaining server errors with retryable error codes as defined
368+
* in the Retryable Error section. */
369+
updateTopologyDescriptionForError(server, error);
370+
previousError = error;
371+
previousServer = server;
362372
} catch (DriverException error) {
363373
if ( previousError != null ) {
364374
throw previousError;

0 commit comments

Comments
 (0)