Skip to content

Commit e6ef3e6

Browse files
authored
Replace the stream_method return to AsyncIterable (#87)
This is to match the type of streaming methods generated by `grpc`, so no conversion to an `AsyncIterator` is needed.
2 parents 242200e + bf5a400 commit e6ef3e6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
- `GrpcStreamBroadcaster` now takes a `AsyncIterable` instead of a `AsyncIterator` as the `stream_method`. This is to match the type of streaming methods generated by `grpc`, so no conversion to an `AsyncIterator` is needed.
1010

1111
## New Features
1212

src/frequenz/client/base/streaming.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import asyncio
77
import logging
8-
from collections.abc import AsyncIterator, Callable
9-
from typing import Generic, TypeVar
8+
from collections.abc import Callable
9+
from typing import AsyncIterable, Generic, TypeVar
1010

1111
import grpc.aio
1212

@@ -30,7 +30,7 @@ class GrpcStreamBroadcaster(Generic[InputT, OutputT]):
3030
def __init__(
3131
self,
3232
stream_name: str,
33-
stream_method: Callable[[], AsyncIterator[InputT]],
33+
stream_method: Callable[[], AsyncIterable[InputT]],
3434
transform: Callable[[InputT], OutputT],
3535
retry_strategy: retry.Strategy | None = None,
3636
):

0 commit comments

Comments
 (0)