Perf improvements after profiling
This commit is contained in:
parent
aaa9838cc4
commit
a22dec763c
3
main.rs
3
main.rs
|
@ -32,9 +32,10 @@ fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
let thread_metrics = metrics.clone();
|
let thread_metrics = metrics.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
|
let filepath = prometheus_file_path.to_owned();
|
||||||
loop {
|
loop {
|
||||||
{
|
{
|
||||||
match File::create(prometheus_file_path.to_owned()) {
|
match File::create(&filepath) {
|
||||||
Ok(mut file) => {
|
Ok(mut file) => {
|
||||||
if let Ok(m) = thread_metrics.lock() {
|
if let Ok(m) = thread_metrics.lock() {
|
||||||
let prom_str = format!("officetemp_humidity {}\nofficetemp_temperature {}\n", m.humidity, m.temperature);
|
let prom_str = format!("officetemp_humidity {}\nofficetemp_temperature {}\n", m.humidity, m.temperature);
|
||||||
|
|
Loading…
Reference in New Issue