From 71beddabd0c36cd847952cd6d21db0f009bd63c7 Mon Sep 17 00:00:00 2001 From: Michael Kofi Armah Date: Thu, 5 Sep 2024 13:44:53 +0000 Subject: [PATCH] [Core] Replaced StopAsyncIteration with a return to prevent errors when no tasks are provided. (#991) # Description **What**: - Replaced `StopAsyncIteration` with a return statement in the `stream_async_iterators_tasks` function. This ensures nothing is returned when empty tasks are provided to the function. **Why**: - The use of `StopAsyncIteration` was causing improper error handling in scenarios where no async tasks were provided. By replacing with a return statement, the error is prevented and nothing is returned just as nothing was provided. **How**: - Replaced StopAsyncIteration with a return statement return nothing when an empty list of tasks is passed to the `stream_async_iterators_tasks` function. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) --- CHANGELOG.md | 7 +++++++ port_ocean/utils/async_iterators.py | 2 +- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8873f23374..4aded69b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## 0.10.9 (2024-09-05) + +### Bug Fixes + +- Replaced StopAsyncIteration with a return statement to ignore prevent errors in cases where empty tasks are sent to the stream_async_iterators_tasks function + + ## 0.10.8 (2024-09-04) ### Bug Fixes diff --git a/port_ocean/utils/async_iterators.py b/port_ocean/utils/async_iterators.py index ec27849ec5..0d1158ab74 100644 --- a/port_ocean/utils/async_iterators.py +++ b/port_ocean/utils/async_iterators.py @@ -36,7 +36,7 @@ async def main(): :return: A stream of results """ if not tasks: - raise StopAsyncIteration("No tasks provided") + return if len(tasks) == 1: async for batch_items in tasks[0]: diff --git a/pyproject.toml b/pyproject.toml index 4ef1caabb7..92feb96bd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.10.8" +version = "0.10.9" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"