Skip to content

Commit 8c8fd34

Browse files
committed
PYTHON-5745 Remove redundant duration local in _CommandTelemetry
1 parent adfa863 commit 8c8fd34

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

pymongo/_telemetry.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,12 @@ def succeeded(
124124
self._duration = datetime.datetime.now() - self._start
125125
if not self._should_log and not self._publish:
126126
return
127-
duration = self._duration
128127
if self._should_log:
129128
_debug_log(
130129
_COMMAND_LOGGER,
131130
message=_CommandStatusMessage.SUCCEEDED,
132131
clientId=self._topology_id,
133-
durationMS=duration,
132+
durationMS=self._duration,
134133
reply=reply,
135134
commandName=self._name,
136135
databaseName=self._dbname,
@@ -146,7 +145,7 @@ def succeeded(
146145
if self._publish:
147146
assert self._listeners is not None
148147
self._listeners.publish_command_success(
149-
duration,
148+
self._duration,
150149
reply,
151150
command_name,
152151
self._request_id,
@@ -168,13 +167,12 @@ def failed(
168167
self._duration = datetime.datetime.now() - self._start
169168
if not self._should_log and not self._publish:
170169
return
171-
duration = self._duration
172170
if self._should_log:
173171
_debug_log(
174172
_COMMAND_LOGGER,
175173
message=_CommandStatusMessage.FAILED,
176174
clientId=self._topology_id,
177-
durationMS=duration,
175+
durationMS=self._duration,
178176
failure=failure,
179177
commandName=self._name,
180178
databaseName=self._dbname,
@@ -190,7 +188,7 @@ def failed(
190188
if self._publish:
191189
assert self._listeners is not None
192190
self._listeners.publish_command_failure(
193-
duration,
191+
self._duration,
194192
failure,
195193
command_name,
196194
self._request_id,

0 commit comments

Comments
 (0)