Skip to content

Commit adfa863

Browse files
committed
PYTHON-5745 Fix speculative_hello computed regardless of APM state
1 parent a08f326 commit adfa863

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

pymongo/asynchronous/command_runner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ async def run_command(
378378
:param write_concern: The write concern for this command. Applied via CSOT.
379379
"""
380380
name = next(iter(spec))
381-
speculative_hello = False
382381

383382
# Publish the original command document, perhaps with lsid and $clusterTime.
384383
orig = spec
@@ -391,8 +390,7 @@ async def run_command(
391390
spec["collation"] = collation
392391

393392
topology_id = client._topology_settings._topology_id if client is not None else None
394-
if listeners is not None and listeners.enabled_for_commands:
395-
speculative_hello = _is_speculative_authenticate(name, spec)
393+
speculative_hello = _is_speculative_authenticate(name, spec)
396394

397395
if compression_ctx and name.lower() in _NO_COMPRESSION:
398396
compression_ctx = None

pymongo/synchronous/command_runner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ def run_command(
378378
:param write_concern: The write concern for this command. Applied via CSOT.
379379
"""
380380
name = next(iter(spec))
381-
speculative_hello = False
382381

383382
# Publish the original command document, perhaps with lsid and $clusterTime.
384383
orig = spec
@@ -391,8 +390,7 @@ def run_command(
391390
spec["collation"] = collation
392391

393392
topology_id = client._topology_settings._topology_id if client is not None else None
394-
if listeners is not None and listeners.enabled_for_commands:
395-
speculative_hello = _is_speculative_authenticate(name, spec)
393+
speculative_hello = _is_speculative_authenticate(name, spec)
396394

397395
if compression_ctx and name.lower() in _NO_COMPRESSION:
398396
compression_ctx = None

0 commit comments

Comments
 (0)