refactor(integrations): IngestWatchEventDeps, scoped Arc deps, WatchEventCleanupJob

This commit is contained in:
2026-06-11 22:01:15 +02:00
parent 76edd52bb0
commit b29f3020e6
22 changed files with 216 additions and 216 deletions

View File

@@ -1,17 +1,16 @@
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use domain::{errors::DomainError, ports::PeriodicJob};
use crate::context::AppContext;
use domain::{errors::DomainError, ports::{PeriodicJob, WatchEventRepository}};
pub struct WatchEventCleanupJob {
ctx: AppContext,
watch_event: Arc<dyn WatchEventRepository>,
}
impl WatchEventCleanupJob {
pub fn new(ctx: AppContext) -> Self {
Self { ctx }
pub fn new(watch_event: Arc<dyn WatchEventRepository>) -> Self {
Self { watch_event }
}
}
@@ -22,7 +21,7 @@ impl PeriodicJob for WatchEventCleanupJob {
}
async fn run(&self) -> Result<(), DomainError> {
let n = crate::integrations::cleanup::execute(&self.ctx).await?;
let n = crate::integrations::cleanup::execute(self.watch_event.clone()).await?;
if n > 0 {
tracing::info!("watch event cleanup: removed {n} old entries");
}