Style: Automatische Formatierung & Clippy-Fixes
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 16s
Security Scans / Trivy & OSV-Scanner (push) Successful in 34s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 35s

This commit is contained in:
2026-09-14 22:51:40 +00:00
parent 232e39f518
commit 2b9e761d9e
2 changed files with 5 additions and 15 deletions
+4 -11
View File
@@ -157,9 +157,8 @@ pub fn is_expired(updated_at: i64, now: i64, ttl_seconds: u64) -> bool {
fn ensure_cache_dir(dir: &Path) -> Result<(), String> { fn ensure_cache_dir(dir: &Path) -> Result<(), String> {
if !dir.exists() { if !dir.exists() {
std::fs::create_dir_all(dir).map_err(|e| { std::fs::create_dir_all(dir)
format!("could not create directory '{}': {e}", dir.display()) .map_err(|e| format!("could not create directory '{}': {e}", dir.display()))?;
})?;
// create_dir_all() unterliegt dem Prozess-Umask; explizites chmod ist nötig, um // create_dir_all() unterliegt dem Prozess-Umask; explizites chmod ist nötig, um
// wirklich 0777 zu erreichen (Verzeichnis-Rechte steuern nicht die Umask neuer Dateien). // wirklich 0777 zu erreichen (Verzeichnis-Rechte steuern nicht die Umask neuer Dateien).
// Wird nur beim Neuanlegen ausgeführt; bei existierenden Verzeichnissen würde ein // Wird nur beim Neuanlegen ausgeführt; bei existierenden Verzeichnissen würde ein
@@ -198,10 +197,7 @@ pub async fn try_open_cache(db_path: &Path) -> Option<Cache> {
{ {
Ok(db) => db, Ok(db) => db,
Err(e) => { Err(e) => {
crate::log::warn( crate::log::warn("cache", &format!("Could not open cache database: {e}"));
"cache",
&format!("Could not open cache database: {e}"),
);
return None; return None;
} }
}; };
@@ -216,10 +212,7 @@ pub async fn try_open_cache(db_path: &Path) -> Option<Cache> {
let cache = Cache { conn }; let cache = Cache { conn };
if let Err(e) = cache.init_schema().await { if let Err(e) = cache.init_schema().await {
crate::log::warn( crate::log::warn("cache", &format!("Could not initialize cache schema: {e}"));
"cache",
&format!("Could not initialize cache schema: {e}"),
);
return None; return None;
} }
+1 -4
View File
@@ -55,10 +55,7 @@ pub async fn resolve(
&& !cache::is_expired(entry.updated_at, now, config.cache_ttl_seconds) && !cache::is_expired(entry.updated_at, now, config.cache_ttl_seconds)
&& network::ping_check(entry.ip).await && network::ping_check(entry.ip).await
{ {
crate::log::info( crate::log::info("resolver", &format!("Cache hit for {mac}: {}", entry.ip));
"resolver",
&format!("Cache hit for {mac}: {}", entry.ip),
);
return Ok(ResolveResult { return Ok(ResolveResult {
mac: *mac, mac: *mac,
ip: entry.ip, ip: entry.ip,