nix fmt + rustfmt sweep

This commit is contained in:
müde 2026-05-17 01:40:28 +02:00
parent 0cf120e9e9
commit 411cf86632
16 changed files with 171 additions and 133 deletions

View file

@ -18,11 +18,7 @@ pub struct AgentSocket {
pub handle: JoinHandle<()>,
}
pub fn start(
agent: &str,
socket_path: &Path,
coord: Arc<Coordinator>,
) -> Result<AgentSocket> {
pub fn start(agent: &str, socket_path: &Path, coord: Arc<Coordinator>) -> Result<AgentSocket> {
let agent = agent.to_owned();
if let Some(parent) = socket_path.parent() {
std::fs::create_dir_all(parent)
@ -215,21 +211,29 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
let now = std::time::SystemTime::now();
let future = match now.checked_add(std::time::Duration::from_secs(*seconds)) {
Some(t) => t,
None => return AgentResponse::Err {
message: format!("InSeconds overflow: {seconds}s exceeds system time range"),
},
None => {
return AgentResponse::Err {
message: format!(
"InSeconds overflow: {seconds}s exceeds system time range"
),
};
}
};
let duration = match future.duration_since(std::time::UNIX_EPOCH) {
Ok(d) => d,
Err(e) => return AgentResponse::Err {
message: format!("system time before UNIX_EPOCH: {e}"),
},
Err(e) => {
return AgentResponse::Err {
message: format!("system time before UNIX_EPOCH: {e}"),
};
}
};
match i64::try_from(duration.as_secs()) {
Ok(ts) => Ok(ts),
Err(e) => return AgentResponse::Err {
message: format!("unix timestamp exceeds i64 range: {e}"),
},
Err(e) => {
return AgentResponse::Err {
message: format!("unix timestamp exceeds i64 range: {e}"),
};
}
}
}
ReminderTiming::At { unix_timestamp } => Ok(*unix_timestamp),