Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous subscription at a specific frequency #21

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion kuksa-client/kuksa_client/grpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,11 @@ def set(self, updates: Collection[EntryUpdate], **rpc_kwargs) -> None:
self._process_set_response(resp)

@check_connected
def subscribe(self, entries: Iterable[SubscribeEntry], **rpc_kwargs) -> Iterator[List[EntryUpdate]]:
def subscribe(self,
entries: Iterable[SubscribeEntry],
frequency: Optional[int],
**rpc_kwargs,
) -> Iterator[List[EntryUpdate]]:
"""
Parameters:
rpc_kwargs
Expand All @@ -969,6 +973,8 @@ def subscribe(self, entries: Iterable[SubscribeEntry], **rpc_kwargs) -> Iterator
rpc_kwargs["metadata"] = self.generate_metadata_header(
rpc_kwargs.get("metadata"))
req = self._prepare_subscribe_request(entries)
if frequency is not None:
req.frequency_hertz = frequency
resp_stream = self.client_stub.Subscribe(req, **rpc_kwargs)
try:
for resp in resp_stream:
Expand Down
3 changes: 3 additions & 0 deletions kuksa-client/kuksa_client/grpc/aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ async def set(self, updates: Collection[EntryUpdate], **rpc_kwargs) -> None:
@check_connected_async_iter
async def subscribe(self,
entries: Iterable[SubscribeEntry],
frequency: Optional[int],
**rpc_kwargs,
) -> AsyncIterator[List[EntryUpdate]]:
"""
Expand All @@ -343,6 +344,8 @@ async def subscribe(self,
rpc_kwargs["metadata"] = self.generate_metadata_header(
rpc_kwargs.get("metadata"))
req = self._prepare_subscribe_request(entries)
if frequency is not None:
req.frequency_hertz = frequency
resp_stream = self.client_stub.Subscribe(req, **rpc_kwargs)
try:
async for resp in resp_stream:
Expand Down
Loading