Fix handling of 0 history samples range
This can happen when polling the history buffer very frequently (<= 1 second).
This commit is contained in:
parent
2ac5944824
commit
30e4b27516
1 changed files with 3 additions and 0 deletions
|
@ -765,6 +765,9 @@ def _compute_sample_range(history, parse_samples, start=None, verbose=False):
|
||||||
if start is None or start < current - parse_samples:
|
if start is None or start < current - parse_samples:
|
||||||
start = current - parse_samples
|
start = current - parse_samples
|
||||||
|
|
||||||
|
if start == current:
|
||||||
|
return range(0), 0, current
|
||||||
|
|
||||||
# This is ring buffer offset, so both index to oldest data sample and
|
# This is ring buffer offset, so both index to oldest data sample and
|
||||||
# index to next data sample after the newest one.
|
# index to next data sample after the newest one.
|
||||||
end_offset = current % samples
|
end_offset = current % samples
|
||||||
|
|
Loading…
Reference in a new issue