story-kit: merge 133_story_clean_up_agent_state_on_story_archive_and_add_ttl_for_completed_entries
This commit is contained in:
@@ -95,6 +95,21 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
|
||||
let app = build_routes(ctx);
|
||||
|
||||
// Background reaper: periodically remove completed/failed agent entries
|
||||
// that have exceeded the TTL.
|
||||
{
|
||||
let reaper_agents = Arc::clone(&startup_agents);
|
||||
let ttl = std::time::Duration::from_secs(agents::DEFAULT_AGENT_TTL_SECS);
|
||||
tokio::spawn(async move {
|
||||
// Check every 5 minutes.
|
||||
let interval = std::time::Duration::from_secs(300);
|
||||
loop {
|
||||
tokio::time::sleep(interval).await;
|
||||
reaper_agents.reap_expired_agents(ttl);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// On startup:
|
||||
// 1. Reconcile any stories whose agent work was committed while the server was
|
||||
// offline (worktree has commits ahead of master but pipeline didn't advance).
|
||||
|
||||
Reference in New Issue
Block a user