| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
Merging this PR will not alter performance✅ 6 untouched benchmarks Comparing feat/run-status-cli (e1d6d41) with main (bd93928) |
Sorry, something went wrong.
| while self._pipeline_task is not None and not self._pipeline_task.done(): | ||
| await asyncio.sleep(self.heartbeat_interval_seconds) | ||
| self.write_now() | ||
| except asyncio.CancelledError: |
Code scanning / CodeQL
Empty except Note
AI 6 months ago
In general, empty except blocks should either (a) perform some explicit handling (logging, cleanup, state updates), or (b) include a clear comment explaining why ignoring the exception is safe and intentional. This preserves debuggability and avoids accidentally hiding errors.
For this specific case, the best minimal fix without changing functionality is:
Concretely:
74: async def _heartbeat_loop(self) -> None:
75: try:
76: while self._pipeline_task is not None and not self._pipeline_task.done():
77: await asyncio.sleep(self.heartbeat_interval_seconds)
78: self.write_now()
79: except asyncio.CancelledError:
80: passwith an implementation that includes an explanatory comment and exits the coroutine explicitly in the except block, preserving all existing behavior.
No new imports or helper functions are needed.
cat << 'EOF' | git apply
diff --git a/pipefunc/_run_status_heartbeat.py b/pipefunc/_run_status_heartbeat.py
--- a/pipefunc/_run_status_heartbeat.py
+++ b/pipefunc/_run_status_heartbeat.py
@@ -77,7 +77,9 @@
await asyncio.sleep(self.heartbeat_interval_seconds)
self.write_now()
except asyncio.CancelledError:
- pass
+ # Expected during normal shutdown when the heartbeat task is cancelled.
+ # Swallow the cancellation to allow a clean exit without traceback.
+ return
def _on_task_done(self, task: asyncio.Task[Any]) -> None:
if self._heartbeat_task is not None:
EOF
| @@ -77,7 +77,9 @@ | ||
| await asyncio.sleep(self.heartbeat_interval_seconds) | ||
| self.write_now() | ||
| except asyncio.CancelledError: | ||
| pass | ||
| # Expected during normal shutdown when the heartbeat task is cancelled. | ||
| # Swallow the cancellation to allow a clean exit without traceback. | ||
| return | ||
|
|
||
| def _on_task_done(self, task: asyncio.Task[Any]) -> None: | ||
| if self._heartbeat_task is not None: |
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match the correct format. Thank you! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary