File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/frequenz/sdk/timeseries/battery_pool Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2121 ComponentMetricId ,
2222 InverterData ,
2323)
24+ from typing_extensions import override
2425
2526from ..._internal ._asyncio import AsyncConstructible
2627from ..._internal ._constants import MAX_BATTERY_DATA_AGE_SEC
@@ -68,6 +69,10 @@ async def async_new(
6869 async def fetch_next (self ) -> ComponentMetricsData | None :
6970 """Fetch metrics for this component."""
7071
72+ @abstractmethod
73+ def stop (self ) -> None :
74+ """Stop the metric fetcher."""
75+
7176
7277class LatestMetricsFetcher (ComponentMetricFetcher , Generic [T ], ABC ):
7378 """Subscribe for the latest component data and extract the needed metrics."""
@@ -143,6 +148,11 @@ async def fetch_next(self) -> ComponentMetricsData | None:
143148
144149 return ComponentMetricsData (self ._component_id , data .timestamp , metrics )
145150
151+ @override
152+ def stop (self ) -> None :
153+ """Stop the metric fetcher."""
154+ self ._receiver .close ()
155+
146156 @abstractmethod
147157 def _extract_metric (self , data : T , mid : ComponentMetricId ) -> float : ...
148158
You can’t perform that action at this time.
0 commit comments