Skip to content

Commit

Permalink
[Core] Replaced StopAsyncIteration with a return to prevent errors wh…
Browse files Browse the repository at this point in the history
…en 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)
  • Loading branch information
mk-armah authored Sep 5, 2024
1 parent bfd4767 commit 71bedda
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->

## 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
Expand Down
2 changes: 1 addition & 1 deletion port_ocean/utils/async_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 71bedda

Please sign in to comment.