diff --git a/src/application/services/storage_usage_service.rs b/src/application/services/storage_usage_service.rs index 5f6369df..35b1d3ec 100644 --- a/src/application/services/storage_usage_service.rs +++ b/src/application/services/storage_usage_service.rs @@ -693,7 +693,10 @@ impl StorageUsagePort for StorageUsageService { })?; let corrected = result.rows_affected(); - info!("Storage-usage reconciliation corrected {} user(s)", corrected); + info!( + "Storage-usage reconciliation corrected {} user(s)", + corrected + ); Ok(corrected) } diff --git a/src/common/di.rs b/src/common/di.rs index 6034fed6..fd1db87e 100644 --- a/src/common/di.rs +++ b/src/common/di.rs @@ -1141,9 +1141,8 @@ impl AppServiceFactory { // Registered with the periodic-job scheduler // (`docs/plan/job-registry.md` Part 1); the retired // `start_reconciliation_job` used to spawn its own interval loop. - let interval = StorageUsageService::reconciliation_interval( - self.config.storage.usage_reconcile_secs, - ); + let interval = + StorageUsageService::reconciliation_interval(self.config.storage.usage_reconcile_secs); if let Err(e) = core .job_registry .register(service.clone(), Some(interval), None) @@ -1286,8 +1285,7 @@ impl AppServiceFactory { if let Err(e) = core .job_registry .register( - core.dedup_service.clone() - as Arc, + core.dedup_service.clone() as Arc, None, // on-demand only None, // no timeout ) @@ -1357,7 +1355,13 @@ impl AppServiceFactory { // path inside the application services, and re-exposed on AppState // for the handler-side quota checks of the byte-upload paths). let storage_usage = self - .create_storage_usage_service(&repos, &pool, &maintenance_pool, drive_repo.clone(), &core) + .create_storage_usage_service( + &repos, + &pool, + &maintenance_pool, + drive_repo.clone(), + &core, + ) .await; // 3d. Content index (embedded Tantivy) — opened before application diff --git a/src/infrastructure/scheduler/engine.rs b/src/infrastructure/scheduler/engine.rs index 2d035439..d6c05a84 100644 --- a/src/infrastructure/scheduler/engine.rs +++ b/src/infrastructure/scheduler/engine.rs @@ -144,10 +144,7 @@ pub(super) async fn dispatch(name: &str, entry: Arc) -> JobOutcome { name, ); advance_next_run(&entry); - return JobOutcome::ok_with( - 0, - serde_json::json!({ "skipped": "already_running" }), - ); + return JobOutcome::ok_with(0, serde_json::json!({ "skipped": "already_running" })); } }; @@ -196,8 +193,7 @@ pub(super) async fn dispatch(name: &str, entry: Arc) -> JobOutcome { // by one interval, no backlog queueing. state.next_run_at = entry.interval.map(|dur| { Utc::now() - + chrono::Duration::from_std(dur) - .unwrap_or_else(|_| chrono::Duration::seconds(0)) + + chrono::Duration::from_std(dur).unwrap_or_else(|_| chrono::Duration::seconds(0)) }); } @@ -217,8 +213,7 @@ fn advance_next_run(entry: &JobEntry) { let mut state = entry.state.lock().expect("JobState mutex poisoned"); state.next_run_at = entry.interval.map(|dur| { Utc::now() - + chrono::Duration::from_std(dur) - .unwrap_or_else(|_| chrono::Duration::seconds(0)) + + chrono::Duration::from_std(dur).unwrap_or_else(|_| chrono::Duration::seconds(0)) }); } diff --git a/src/infrastructure/scheduler/registry.rs b/src/infrastructure/scheduler/registry.rs index eaab8d57..4e8fe41d 100644 --- a/src/infrastructure/scheduler/registry.rs +++ b/src/infrastructure/scheduler/registry.rs @@ -95,8 +95,7 @@ impl JobRegistry { } let next_run_at = interval.map(|dur| { Utc::now() - + chrono::Duration::from_std(dur) - .unwrap_or_else(|_| chrono::Duration::seconds(0)) + + chrono::Duration::from_std(dur).unwrap_or_else(|_| chrono::Duration::seconds(0)) }); let entry = Arc::new(JobEntry { handler, @@ -186,10 +185,7 @@ impl JobRegistry { /// /// Works for BOTH scheduled and on-demand jobs — for on-demand /// jobs this is the only way they ever run. - pub async fn trigger( - self: &Arc, - name: &str, - ) -> Option { + pub async fn trigger(self: &Arc, name: &str) -> Option { let entry = self.get(name).await?; Some(super::engine::dispatch(name, entry).await) } @@ -287,7 +283,9 @@ mod tests { .await .unwrap(); // On-demand job — supervisor must never pick it. - reg.register(handler("on_demand"), None, None).await.unwrap(); + reg.register(handler("on_demand"), None, None) + .await + .unwrap(); let (next_name, _) = reg.pick_next().await.expect("scheduled job due"); assert_eq!( diff --git a/src/infrastructure/services/dedup_service.rs b/src/infrastructure/services/dedup_service.rs index 199997b1..45852e21 100644 --- a/src/infrastructure/services/dedup_service.rs +++ b/src/infrastructure/services/dedup_service.rs @@ -3151,10 +3151,9 @@ impl crate::infrastructure::scheduler::JobHandler for DedupService { async fn run(&self) -> crate::infrastructure::scheduler::JobOutcome { use crate::infrastructure::scheduler::JobOutcome; match self.garbage_collect().await { - Ok((items, bytes)) => JobOutcome::ok_with( - items, - serde_json::json!({ "bytes_reclaimed": bytes }), - ), + Ok((items, bytes)) => { + JobOutcome::ok_with(items, serde_json::json!({ "bytes_reclaimed": bytes })) + } Err(e) => JobOutcome::Err(format!("dedup GC failed: {e}")), } } diff --git a/src/infrastructure/services/grant_cleanup_service.rs b/src/infrastructure/services/grant_cleanup_service.rs index 5c73bd03..64de01d5 100644 --- a/src/infrastructure/services/grant_cleanup_service.rs +++ b/src/infrastructure/services/grant_cleanup_service.rs @@ -122,10 +122,9 @@ impl JobHandler for GrantCleanupService { /// `Arc` from the handler. async fn run(&self) -> JobOutcome { match self.purge(None).await { - Ok(count) => JobOutcome::ok_with( - count, - serde_json::json!({ "grace_days": self.grace_days }), - ), + Ok(count) => { + JobOutcome::ok_with(count, serde_json::json!({ "grace_days": self.grace_days })) + } Err(e) => JobOutcome::Err(format!("grant cleanup failed: {e}")), } }