Skip to content

Commit 053b579

Browse files
Bernd VerstCopilot
andcommitted
Discard awaitable result with explicit underscore in resiliency interceptor
CodeQL's `py/ineffectual-statement` heuristic re-flagged `await result` in `AsyncClientResiliencyInterceptor._record_outcome` after the previous fix: the rule treats expression statements whose value is discarded as unused, and does not recognise that `await` is always a side-effecting suspension point (the whole purpose of the call is to run the async recreate callback to completion). Rewriting the line as `_ = await result` keeps the exact same runtime behaviour but documents the intent (return value intentionally discarded) and satisfies the linter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 935503f commit 053b579

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

durabletask/internal/grpc_resiliency.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ async def _record_outcome(self, method: str, error: Optional[BaseException]) ->
149149
if self._failure_tracker.record_failure():
150150
result = self._on_recreate()
151151
if inspect.isawaitable(result):
152-
await result
152+
# ``_ =`` signals that we await purely for the side effect
153+
# of running the recreate callback to completion; the
154+
# awaitable's return value is intentionally discarded.
155+
_ = await result
153156
else:
154157
self._failure_tracker.record_success()

0 commit comments

Comments
 (0)