fix(runtime): isolate agent state by project (#101)
This commit is contained in:
@ -77,10 +77,11 @@ impl ReconcileLiveState {
|
||||
///
|
||||
/// # Errors
|
||||
/// [`AppError::Store`] sur défaillance de chargement ou d'upsert du store.
|
||||
pub async fn execute(&self, _input: ReconcileLiveStateInput) -> Result<(), AppError> {
|
||||
pub async fn execute(&self, input: ReconcileLiveStateInput) -> Result<(), AppError> {
|
||||
let state = self.store.load().await?;
|
||||
let now_ms = u64::try_from(self.clock.now_millis()).unwrap_or(0);
|
||||
let reconciled = state.reconcile_orphans(|a| self.registry.is_agent_live(a), now_ms);
|
||||
let reconciled =
|
||||
state.reconcile_orphans(|a| self.registry.is_agent_live(input.project_id, a), now_ms);
|
||||
for entry in reconciled {
|
||||
self.store.upsert(entry).await?;
|
||||
}
|
||||
@ -125,7 +126,7 @@ mod tests {
|
||||
live: HashSet<AgentId>,
|
||||
}
|
||||
impl LiveAgentRegistry for FakeRegistry {
|
||||
fn is_agent_live(&self, agent_id: &AgentId) -> bool {
|
||||
fn is_agent_live(&self, _project_id: domain::ProjectId, agent_id: &AgentId) -> bool {
|
||||
self.live.contains(agent_id)
|
||||
}
|
||||
fn is_node_live(&self, _node_id: &NodeId) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user