Perf improvements after profiling

This commit is contained in:
Félix Baylac-Jacqué 2022-06-17 12:09:12 +02:00
parent aaa9838cc4
commit a22dec763c
No known key found for this signature in database
GPG Key ID: EFD315F31848DBA4
1 changed files with 2 additions and 1 deletions

View File

@ -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);