Skip to content

Commit 150099c

Browse files
committed
Rename retry_spec to retry_strategy
This is to make it more consistent with the `Strategy` class name. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent bfcccbc commit 150099c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ Code import from the [SDK v1.0.0-rc5](https://github.com/frequenz-floss/frequenz
99
Changes compared to the code in the SDK v1.0.0-rc5 release:
1010

1111
* The `MicrogridGrpcClient` class was renamed to `ApiClient`.
12+
13+
* The `retry_spec` constructor argument was renamed to `retry_strategy`.
14+
1215
* The `MicrogridApiClient` abstract base class was removed, use `ApiClient` instead.
16+
1317
* The `Connection` class is now a `dataclass` instead of a `NamedTuple`. If you use the tuple-like interface (`connection[0]`, etc.) you should use the named attributes instead or use [`dataclasses.astuple()`](https://docs.python.org/3/library/dataclasses.html#dataclasses.astuple) to convert it to a tuple.

src/frequenz/client/microgrid/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ def __init__(
6767
self,
6868
grpc_channel: grpc.aio.Channel,
6969
target: str,
70-
retry_spec: retry.Strategy = retry.LinearBackoff(),
70+
retry_strategy: retry.Strategy = retry.LinearBackoff(),
7171
) -> None:
7272
"""Initialize the class instance.
7373
7474
Args:
7575
grpc_channel: asyncio-supporting gRPC channel
7676
target: server (host:port) to be used for asyncio-supporting gRPC
7777
channel that the client should use to contact the API
78-
retry_spec: Specs on how to retry if the connection to a streaming
79-
method gets lost.
78+
retry_strategy: The retry strategy to use to reconnect when the connection
79+
to the streaming method is lost.
8080
"""
8181
self.target = target
8282
"""The location (as "host:port") of the microgrid API gRPC server."""
@@ -85,7 +85,7 @@ def __init__(
8585
"""The gRPC stub for the microgrid API."""
8686

8787
self._broadcasters: dict[int, streaming.GrpcStreamBroadcaster[Any, Any]] = {}
88-
self._retry_spec = retry_spec
88+
self._retry_strategy = retry_strategy
8989

9090
async def components(self) -> Iterable[Component]:
9191
"""Fetch all the components present in the microgrid.

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def _gprc_server(
6767
microgrid = client.ApiClient(
6868
grpc.aio.insecure_channel(f"[::]:{port}"),
6969
f"[::]:{port}",
70-
retry_spec=LinearBackoff(interval=0.0, jitter=0.05),
70+
retry_strategy=LinearBackoff(interval=0.0, jitter=0.05),
7171
)
7272
await server.start()
7373
try:

0 commit comments

Comments
 (0)