Chore: Cleanup duplicate unix_now (use the common one)

This commit is contained in:
Herbert Wolverson committed 2026-06-22 13:12:05 -05:00
1 parent 56890b6396
commit df1c9848d3
4 files changed
+6 -13

No files matched your search

+1
View File
@@ -2496,6 +2496,7 @@ dependencies = [
"lqos_overrides",
"lqos_probe",
"lqos_topology_compile",
"lqos_utils",
"serde_json",
"tokio",
"tracing",
+1
View File
@@ -14,3 +14,4 @@ lqos_config = { path = "../lqos_config" }
lqos_overrides = { path = "../lqos_overrides" }
lqos_probe = { path = "../lqos_probe" }
lqos_topology_compile = { path = "../lqos_topology_compile" }
lqos_utils = { path = "../lqos_utils" }
+3 -8
View File
@@ -31,7 +31,6 @@ use std::io::Write;
use std::net::IpAddr;
use std::path::{Path, PathBuf};
use std::thread;
use std::time::{SystemTime, UNIX_EPOCH};
const TOPOLOGY_EFFECTIVE_PUBLISH_LOCK_FILENAME: &str = "topology_effective_publish.lock";
const TOPOLOGY_WARNING_EXAMPLE_LIMIT: usize = 5;
@@ -188,10 +187,7 @@ pub struct AttachmentProbeSpec {
}
fn now_unix() -> Option<u64> {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.ok()
.map(|duration| duration.as_secs())
lqos_utils::unix_time::unix_now().ok()
}
fn atomic_write_json_value(path: &Path, value: &Value) -> Result<()> {
@@ -1097,9 +1093,8 @@ fn build_flat_bucket_assignments(
&bucket_names,
&BTreeMap::new(),
&BTreeMap::new(),
SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|duration| duration.as_secs_f64())
lqos_utils::unix_time::unix_now()
.map(|timestamp| timestamp as f64)
.unwrap_or(0.0),
&TopLevelPlannerParams {
mode: planner_mode,
+1 -5
View File
@@ -6,17 +6,13 @@ use lqos_config::{
use std::collections::HashMap;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::{AttachmentProbeSpec, is_health_state_fresh};
use super::probe::parse_probe_ip;
pub(super) fn now_unix() -> Option<u64> {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.ok()
.map(|duration| duration.as_secs())
lqos_utils::unix_time::unix_now().ok()
}
fn probe_unavailable_reason(local_ip: &str, remote_ip: &str) -> String {