(dir: &Path, now: i64)
| 803 | } |
| 804 | |
| 805 | fn cleanup_expired(dir: &Path, now: i64) { |
| 806 | let entries = match fs::read_dir(dir) { |
| 807 | Ok(entries) => entries, |
| 808 | Err(_) => return, |
| 809 | }; |
| 810 | for entry in entries.flatten() { |
| 811 | let path = entry.path(); |
| 812 | if path.extension().and_then(|e| e.to_str()) != Some("json") { |
| 813 | continue; |
| 814 | } |
| 815 | let expired = fs::read_to_string(&path) |
| 816 | .ok() |
| 817 | .and_then(|data| serde_json::from_str::<ManagedLifecycle>(&data).ok()) |
| 818 | .map(|l| l.is_expired(now)) |
| 819 | .unwrap_or(false); |
| 820 | if expired { |
| 821 | if let Some(run_id) = path.file_stem().and_then(|stem| stem.to_str()) { |
| 822 | let _ = fs::remove_file(lifecycle_refusal_path(dir, run_id)); |
| 823 | } |
| 824 | let _ = fs::remove_file(&path); |
| 825 | } |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | fn list_by_state(dir: &Path, now: i64) -> (Vec<ManagedLifecycle>, Vec<ManagedLifecycle>) { |
| 830 | list_lifecycles(dir) |
nothing calls this directly
no test coverage detected