@@ -130,24 +130,6 @@ def bulk_ctx_class(self) -> Type[_BulkWriteContext]:
130
130
self .is_encrypted = False
131
131
return _BulkWriteContext
132
132
133
- # @property
134
- # def is_retryable(self) -> bool:
135
- # if self.current_run:
136
- # return self.current_run.is_retryable
137
- # return True
138
- #
139
- # @property
140
- # def retrying(self) -> bool:
141
- # if self.current_run:
142
- # return self.current_run.retrying
143
- # return False
144
- #
145
- # @property
146
- # def started_retryable_write(self) -> bool:
147
- # if self.current_run:
148
- # return self.current_run.started_retryable_write
149
- # return False
150
-
151
133
def add_insert (self , document : _DocumentOut ) -> bool :
152
134
"""Add an insert document to the list of ops."""
153
135
validate_is_document_type ("document" , document )
@@ -579,7 +561,6 @@ async def _execute_command(
579
561
# Start a new retryable write unless one was already
580
562
# started for this command.
581
563
if retryable and self .is_retryable and not self .started_retryable_write :
582
- # print("starting retrayable write")
583
564
session ._start_retryable_write ()
584
565
self .started_retryable_write = True
585
566
session ._apply_to (
@@ -596,6 +577,7 @@ async def _execute_command(
596
577
await self .validate_batch (conn , write_concern )
597
578
if write_concern .acknowledged :
598
579
result , to_send = await self ._execute_batch (bwc , cmd , ops , client )
580
+
599
581
# Retryable writeConcernErrors halt the execution of this run.
600
582
wce = result .get ("writeConcernError" , {})
601
583
if wce .get ("code" , 0 ) in _RETRYABLE_ERROR_CODES :
@@ -604,7 +586,9 @@ async def _execute_command(
604
586
full = copy .deepcopy (full_result )
605
587
_merge_command (run , full , run .idx_offset , result )
606
588
_raise_bulk_write_error (full )
589
+
607
590
_merge_command (run , full_result , run .idx_offset , result )
591
+
608
592
# We're no longer in a retry once a command succeeds.
609
593
self .retrying = False
610
594
self .started_retryable_write = False
0 commit comments