fix(daemon): drop unneeded Arc from daemon_writer's Mutex return type
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::Mutex;
|
||||||
use xy_supervisor::logs::RotatingLogWriter;
|
use xy_supervisor::logs::RotatingLogWriter;
|
||||||
|
|
||||||
const LOG_FILE_MAX_BYTES: u64 = 10 * 1024 * 1024;
|
const LOG_FILE_MAX_BYTES: u64 = 10 * 1024 * 1024;
|
||||||
const LOG_FILE_KEEP: usize = 5;
|
const LOG_FILE_KEEP: usize = 5;
|
||||||
|
|
||||||
pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result<Arc<Mutex<RotatingLogWriter>>> {
|
pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result<Mutex<RotatingLogWriter>> {
|
||||||
let writer =
|
let writer =
|
||||||
RotatingLogWriter::open(&log_dir.join("xy.log"), LOG_FILE_MAX_BYTES, LOG_FILE_KEEP)?;
|
RotatingLogWriter::open(&log_dir.join("xy.log"), LOG_FILE_MAX_BYTES, LOG_FILE_KEEP)?;
|
||||||
|
|
||||||
Ok(Arc::new(Mutex::new(writer)))
|
Ok(Mutex::new(writer))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod daemon;
|
mod daemon;
|
||||||
@@ -86,8 +85,6 @@ async fn main() -> std::process::ExitCode {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let file = Arc::into_inner(file).expect("daemon_writer arc has one owner");
|
|
||||||
|
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_env_filter(filter)
|
.with_env_filter(filter)
|
||||||
.with_ansi(false)
|
.with_ansi(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user