Skip to content

Commit 1a88e8e

Browse files
committed
Address review
1 parent bfc9a70 commit 1a88e8e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pymongo/asynchronous/client_bulk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ async def _process_results_cursor(
440440
) -> None:
441441
"""Internal helper for processing the server reply command cursor."""
442442
if result.get("cursor"):
443+
if session:
444+
session._leave_alive = True
443445
coll = AsyncCollection(
444446
database=AsyncDatabase(self.client, "admin"),
445447
name="$cmd.bulkWrite",
@@ -537,7 +539,6 @@ async def _execute_command(
537539
session._start_retryable_write()
538540
self.started_retryable_write = True
539541
session._apply_to(cmd, retryable, ReadPreference.PRIMARY, conn)
540-
session._leave_alive = True
541542
conn.send_cluster_time(cmd, session, self.client)
542543
conn.add_server_api(cmd)
543544
# CSOT: apply timeout before encoding the command.

pymongo/synchronous/client_bulk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ def _process_results_cursor(
438438
) -> None:
439439
"""Internal helper for processing the server reply command cursor."""
440440
if result.get("cursor"):
441+
if session:
442+
session._leave_alive = True
441443
coll = Collection(
442444
database=Database(self.client, "admin"),
443445
name="$cmd.bulkWrite",
@@ -535,7 +537,6 @@ def _execute_command(
535537
session._start_retryable_write()
536538
self.started_retryable_write = True
537539
session._apply_to(cmd, retryable, ReadPreference.PRIMARY, conn)
538-
session._leave_alive = True
539540
conn.send_cluster_time(cmd, session, self.client)
540541
conn.add_server_api(cmd)
541542
# CSOT: apply timeout before encoding the command.

0 commit comments

Comments
 (0)