From a22dec763c6e7424a60463a7bbc2568dd034cb2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 17 Jun 2022 12:09:12 +0200 Subject: [PATCH] Perf improvements after profiling --- main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.rs b/main.rs index 2473145..0fd5ad4 100644 --- a/main.rs +++ b/main.rs @@ -32,9 +32,10 @@ fn main() -> std::io::Result<()> { let thread_metrics = metrics.clone(); thread::spawn(move || { + let filepath = prometheus_file_path.to_owned(); loop { { - match File::create(prometheus_file_path.to_owned()) { + match File::create(&filepath) { Ok(mut file) => { if let Ok(m) = thread_metrics.lock() { let prom_str = format!("officetemp_humidity {}\nofficetemp_temperature {}\n", m.humidity, m.temperature);