Skip to content

Commit 5c34fbe

Browse files
committed
Merge remote-tracking branch 'upstream/v1.0.0-rc6xx' into merge-rc6xx
# By Sahas Subramanian (3) and others # Via GitHub (3) and Sahas Subramanian (1) * upstream/v1.0.0-rc6xx: Update release notes Replace `Task.exception()` with `Task.result()` Fix gap in ring buffer when updating a missing value Clear release notes Set zero power for PV inverters not neccessary to reach target power Fix PV power distribution
2 parents 74b9007 + 956823f commit 5c34fbe

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@
5959
- Fix the handling of canceled tasks in the data sourcing and resampling actor.
6060
- Fix a bug in PV power distribution by excluding inverters that haven't sent any data since startup.
6161
- Prevent stacking of power requests to avoid delays in processing when the power request frequency exceeds the processing time.
62+
- Fixes a bug in the ring buffer in case the updated value is missing and creates a gap in time.

src/frequenz/sdk/timeseries/_ringbuffer/buffer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,11 @@ def _update_gaps(
491491
# New missing entry that is not already in a gap?
492492
if record_as_missing:
493493
if not found_in_gaps:
494+
# If there are no gaps and the new value is not subsequent to the
495+
# newest value, we need to start the new gap after the newest value
496+
start_gap = min(newest + self._sampling_period, timestamp)
494497
self._gaps.append(
495-
Gap(start=timestamp, end=timestamp + self._sampling_period)
498+
Gap(start=start_gap, end=timestamp + self._sampling_period)
496499
)
497500
elif len(self._gaps) > 0:
498501
if found_in_gaps:

tests/timeseries/test_ringbuffer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,12 @@ def test_gaps() -> None: # pylint: disable=too-many-statements
275275
assert buffer.count_covered() == 5
276276
assert len(buffer.gaps) == 0
277277

278-
# whole range gap suffers from sdk#646
278+
# whole range gap
279279
buffer.update(Sample(dt(99), None))
280-
assert buffer.oldest_timestamp == dt(95) # bug: should be None
281-
assert buffer.newest_timestamp == dt(99) # bug: should be None
282-
assert buffer.count_valid() == 4 # bug: should be 0 (whole range gap)
283-
assert buffer.count_covered() == 5 # bug: should be 0
280+
assert buffer.oldest_timestamp is None
281+
assert buffer.newest_timestamp is None
282+
assert buffer.count_valid() == 0
283+
assert buffer.count_covered() == 0
284284
assert len(buffer.gaps) == 1
285285

286286

0 commit comments

Comments
 (0)