Skip to content

Commit 254095c

Browse files
Rename primary_fetcher_sampleprimary_fetcher_value
Also allow `None` values for it. Signed-off-by: Elzbieta Kotulska <[email protected]>
1 parent 29d1699 commit 254095c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,13 @@ async def _fetch_from_fallback(
432432

433433
async def _synchronize_and_fetch_fallback(
434434
self,
435-
primary_fetcher_sample: Sample[QuantityT],
435+
primary_fetcher_value: Sample[QuantityT] | None,
436436
fallback_fetcher: FallbackMetricFetcher[QuantityT],
437437
) -> Sample[QuantityT] | None:
438438
"""Synchronize the fallback fetcher and return the fallback value.
439439
440440
Args:
441-
primary_fetcher_sample: The sample fetched from the primary fetcher.
441+
primary_fetcher_value: The sample fetched from the primary fetcher.
442442
fallback_fetcher: The fallback metric fetcher.
443443
444444
Returns:
@@ -454,14 +454,14 @@ async def _synchronize_and_fetch_fallback(
454454
fallback_fetcher
455455
)
456456

457-
if self._latest_fallback_sample is None:
457+
if primary_fetcher_value is None or self._latest_fallback_sample is None:
458458
return self._latest_fallback_sample
459459

460-
if primary_fetcher_sample.timestamp < self._latest_fallback_sample.timestamp:
460+
if primary_fetcher_value.timestamp < self._latest_fallback_sample.timestamp:
461461
return None
462462

463463
# Synchronize the fallback fetcher with primary one
464-
while primary_fetcher_sample.timestamp > self._latest_fallback_sample.timestamp:
464+
while primary_fetcher_value.timestamp > self._latest_fallback_sample.timestamp:
465465
self._latest_fallback_sample = await self._fetch_from_fallback(
466466
fallback_fetcher
467467
)

0 commit comments

Comments
 (0)