Skip to content

Commit 03e90d8

Browse files
Rename next_valueprimary_value
Signed-off-by: Elzbieta Kotulska <[email protected]>
1 parent ad88541 commit 03e90d8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,22 +482,22 @@ async def fetch_next(self) -> Sample[QuantityT] | None:
482482

483483
async def _fetch_next(self) -> Sample[QuantityT] | None:
484484
# First fetch from primary stream
485-
next_value = None
485+
primary_value: Sample[QuantityT] | None = None
486486
try:
487-
next_value = await self._stream.receive()
487+
primary_value = await self._stream.receive()
488488
except ReceiverError[Any] as err:
489489
_logger.error("Failed to fetch next value from %s: %s", self._name, err)
490490

491491
# We have no fallback, so we just return primary value even if it is not correct.
492492
if self._fallback is None:
493-
return next_value
493+
return primary_value
494494

495-
is_primary_value_valid = next_value is not None and self._is_value_valid(
496-
next_value.value
495+
is_primary_value_valid = primary_value is not None and self._is_value_valid(
496+
primary_value.value
497497
)
498498

499499
if is_primary_value_valid:
500-
return next_value
500+
return primary_value
501501

502502
if not self._fallback.is_running:
503503
_logger.warning(
@@ -508,9 +508,9 @@ async def _fetch_next(self) -> Sample[QuantityT] | None:
508508
# We started fallback, but it has to subscribe.
509509
# We will receive fallback values since the next time window.
510510
self._fallback.start()
511-
return next_value
511+
return primary_value
512512

513-
return await self._synchronize_and_fetch_fallback(next_value, self._fallback)
513+
return await self._synchronize_and_fetch_fallback(primary_value, self._fallback)
514514

515515
@property
516516
def value(self) -> Sample[QuantityT] | None:

0 commit comments

Comments
 (0)