Skip to content

Commit

Permalink
Add exception-recovery for more long-running functions
Browse files Browse the repository at this point in the history
These appear to be the only remaining long-running functions that
don't have their own exception handling.

Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Oct 7, 2024
1 parent 7b5234d commit 8f2c1a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
MeterData,
)

from ..._internal._asyncio import run_forever
from ..._internal._channels import ChannelRegistry
from ...microgrid import connection_manager
from ...timeseries import Sample
Expand Down Expand Up @@ -460,7 +461,7 @@ async def _update_streams(
self.comp_data_tasks[comp_id].cancel()

self.comp_data_tasks[comp_id] = asyncio.create_task(
self._handle_data_stream(comp_id, category)
run_forever(lambda: self._handle_data_stream(comp_id, category))
)

async def add_metric(self, request: ComponentMetricRequest) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from frequenz.client.microgrid import ComponentCategory, ComponentType, InverterType
from typing_extensions import override

from ..._internal._asyncio import run_forever
from ..._internal._channels import ChannelRegistry
from ...actor import Actor
from ...timeseries import Power
Expand Down Expand Up @@ -194,7 +195,7 @@ def _add_system_bounds_tracker(self, component_ids: frozenset[int]) -> None:

# Start the bounds tracker, for ongoing updates.
self._bound_tracker_tasks[component_ids] = asyncio.create_task(
self._bounds_tracker(component_ids, bounds_receiver)
run_forever(lambda: self._bounds_tracker(component_ids, bounds_receiver))
)

def _calculate_shifted_bounds(
Expand Down

0 comments on commit 8f2c1a4

Please sign in to comment.