refactor(job-registry): simplify the job registering*

This commit is contained in:
Edouard Vanbelle
2026-07-28 21:13:09 +02:00
parent 4d64603233
commit 0e8b1fbbeb
8 changed files with 224 additions and 126 deletions
@@ -578,9 +578,25 @@ impl StorageUsageService {
pub const STORAGE_RECONCILE_JOB_NAME: &str = "storage_reconcile";
use crate::infrastructure::scheduler::{JobHandler, JobOutcome, JobRunArgs};
use crate::infrastructure::scheduler::{JobHandler, JobOutcome, JobRegistry, JobRunArgs};
use async_trait::async_trait;
impl StorageUsageService {
/// Register self with the periodic-job scheduler and return the
/// same `Arc<Self>` for DI-style chaining. Scheduled tenant with
/// interval = `max(30s, interval_secs)`. See
/// `docs/plan/job-registry.md` Part 1.
pub async fn register(
self: Arc<Self>,
registry: &JobRegistry,
interval_secs: u64,
) -> Arc<Self> {
let interval = Self::reconciliation_interval(interval_secs);
registry.register(self.clone(), Some(interval), None).await;
self
}
}
#[async_trait]
impl JobHandler for StorageUsageService {
fn name(&self) -> &str {