Skip to content

Commit 1f914df

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 b4dd067 commit 1f914df

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
@@ -210,7 +210,7 @@ def datetime_to_index(
210210
)
211211

212212
def window(
213-
self, start: datetime, end: datetime, force_copy: bool = False
213+
self, start: datetime, end: datetime, *, force_copy: bool = True
214214
) -> FloatArray:
215215
"""Request a view on the data between start timestamp and end timestamp.
216216
@@ -219,7 +219,7 @@ def window(
219219
220220
Will return a copy in the following cases:
221221
* The requested time period is crossing the start/end of the buffer.
222-
* The force_copy parameter was set to True (default False).
222+
* The force_copy parameter was set to True (default True).
223223
224224
The first case can be avoided by using the appropriate
225225
`align_to` value in the constructor so that the data lines up
@@ -231,7 +231,7 @@ def window(
231231
Args:
232232
start: start time of the window.
233233
end: end time of the window.
234-
force_copy: optional, default False. If True, will always create a
234+
force_copy: optional, default True. If True, will always create a
235235
copy of the data.
236236
237237
Raises:

0 commit comments

Comments
 (0)