Skip to content

Commit ad88541

Browse files
Remove unused fetch_next_with_fallback method
Signed-off-by: Elzbieta Kotulska <[email protected]>
1 parent 5c0eed3 commit ad88541

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -469,40 +469,6 @@ async def _synchronize_and_fetch_fallback(
469469
break
470470
return self._latest_fallback_sample
471471

472-
async def fetch_next_with_fallback(
473-
self, fallback_fetcher: FallbackMetricFetcher[QuantityT]
474-
) -> Sample[QuantityT]:
475-
"""Fetch the next value from the primary and fallback streams.
476-
477-
Return the value from the stream that returns a valid value.
478-
If any stream raises an exception, then return the value from
479-
the other stream.
480-
481-
Args:
482-
fallback_fetcher: The fallback metric fetcher.
483-
484-
Returns:
485-
The value fetched from either the primary or fallback stream.
486-
"""
487-
try:
488-
primary = await self._stream.receive()
489-
except ReceiverError[Any] as err:
490-
_logger.error(
491-
"Primary metric fetcher %s failed to fetch next value: %s."
492-
"Using fallback metric fetcher.",
493-
self._name,
494-
err,
495-
)
496-
return await fallback_fetcher.receive()
497-
498-
fallback = await self._synchronize_and_fetch_fallback(primary, fallback_fetcher)
499-
if fallback is None:
500-
return primary
501-
502-
if self._is_value_valid(primary.value):
503-
return primary
504-
return fallback
505-
506472
async def fetch_next(self) -> Sample[QuantityT] | None:
507473
"""Fetch the next value from the stream.
508474

0 commit comments

Comments
 (0)