forked from Proxmox/proxmox
rrd: use saturating_sub to avoid underflow
Without this, the tests fail in debug mode. Also having start (u64) underflow to a value greater than end does not really make sense Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
75ca726c29
commit
8e344d3d67
@ -469,7 +469,7 @@ impl RRD {
|
||||
match rra {
|
||||
Some(rra) => {
|
||||
let end = end.unwrap_or_else(|| proxmox_time::epoch_f64() as u64);
|
||||
let start = start.unwrap_or(end - 10*rra.resolution);
|
||||
let start = start.unwrap_or(end.saturating_sub(10*rra.resolution));
|
||||
Ok(rra.extract_data(start, end, self.source.last_update))
|
||||
}
|
||||
None => bail!("unable to find RRA suitable ({:?}:{})", cf, resolution),
|
||||
|
Loading…
Reference in New Issue
Block a user