RRD_CACHE: use a OnceCell instead of lazy_static

And initialize only with proxmox-backup-proxy. Other binaries dont need it.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dietmar Maurer authored and Thomas Lamprecht committed 2021-10-13 13:36:02 +02:00
1 parent 1d44f175c6
commit fa49d0fde9
5 files changed
+58 -33

No files matched your search

+4 -2
View File
@@ -10,7 +10,7 @@ use pbs_api_types::{
use proxmox_rrd::rrd::RRD_DATA_ENTRIES;
use crate::RRD_CACHE;
use crate::get_rrd_cache;
pub fn create_value_from_rrd(
basedir: &str,
@@ -22,8 +22,10 @@ pub fn create_value_from_rrd(
let mut result = Vec::new();
let now = proxmox_time::epoch_f64();
let rrd_cache = get_rrd_cache()?;
for name in list {
let (start, reso, list) = match RRD_CACHE.extract_cached_data(basedir, name, now, timeframe, cf) {
let (start, reso, list) = match rrd_cache.extract_cached_data(basedir, name, now, timeframe, cf) {
Some(result) => result,
None => continue,
};