From 66f01dd153a23ac1dd8183ff17253c963c021b06 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Fri, 8 Nov 2024 15:07:19 +0100 Subject: [PATCH] Update bound-streaming channels to resend latest to new receivers The `SystemBoundsTracker`s send out a new value only when there's a change in the system bounds. This means when a new receiver is created, it could wait for a long time before receiving the bounds. This change allows new receivers to get the latest state when requested. This is already the case for battery bounds, and needed only for PV and EV charger bounds. Signed-off-by: Sahas Subramanian --- .../ev_charger_pool/_ev_charger_pool_reference_store.py | 3 ++- .../sdk/timeseries/pv_pool/_pv_pool_reference_store.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool_reference_store.py b/src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool_reference_store.py index 7bc7cc291..cca4dbf5a 100644 --- a/src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool_reference_store.py +++ b/src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool_reference_store.py @@ -93,7 +93,8 @@ def __init__( # pylint: disable=too-many-arguments ) self.bounds_channel: Broadcast[SystemBounds] = Broadcast( - name=f"System Bounds for EV Chargers: {component_ids}" + name=f"System Bounds for EV Chargers: {component_ids}", + resend_latest=True, ) self.bounds_tracker: EVCSystemBoundsTracker = EVCSystemBoundsTracker( self.component_ids, diff --git a/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py b/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py index 57a05af4c..0cd7c8f8c 100644 --- a/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py +++ b/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py @@ -94,7 +94,8 @@ def __init__( # pylint: disable=too-many-arguments self.resampler_subscription_sender, ) self.bounds_channel: Broadcast[SystemBounds] = Broadcast( - name=f"System Bounds for PV inverters: {component_ids}" + name=f"System Bounds for PV inverters: {component_ids}", + resend_latest=True, ) self.bounds_tracker: PVSystemBoundsTracker = PVSystemBoundsTracker( self.component_ids,