Skip to content

Commit 3293434

Browse files
committed
Copy by default in ring buffer window
Changing the default is motivated by favouring data integrity over performance concerns which are minor in the majority of the expected applications. Also make force_copy a keyword argument. Signed-off-by: cwasicki <[email protected]>
1 parent cb32255 commit 3293434

File tree

1 file changed

+3
-3
lines changed
  • src/frequenz/sdk/timeseries/_ringbuffer

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def datetime_to_index(
257257
)
258258

259259
def window(
260-
self, start: datetime, end: datetime, force_copy: bool = False
260+
self, start: datetime, end: datetime, *, force_copy: bool = True
261261
) -> FloatArray:
262262
"""Request a view on the data between start timestamp and end timestamp.
263263
@@ -266,7 +266,7 @@ def window(
266266
267267
Will return a copy in the following cases:
268268
* The requested time period is crossing the start/end of the buffer.
269-
* The force_copy parameter was set to True (default False).
269+
* The force_copy parameter was set to True (default True).
270270
271271
The first case can be avoided by using the appropriate
272272
`align_to` value in the constructor so that the data lines up
@@ -278,7 +278,7 @@ def window(
278278
Args:
279279
start: start time of the window.
280280
end: end time of the window.
281-
force_copy: optional, default False. If True, will always create a
281+
force_copy: optional, default True. If True, will always create a
282282
copy of the data.
283283
284284
Raises:

0 commit comments

Comments
 (0)