(jobs)
| 78 | } |
| 79 | |
| 80 | function pruneJobs(jobs) { |
| 81 | return [...jobs] |
| 82 | .sort((left, right) => String(right.updatedAt ?? "").localeCompare(String(left.updatedAt ?? ""))) |
| 83 | .slice(0, MAX_JOBS); |
| 84 | } |
| 85 | |
| 86 | function removeFileIfExists(filePath) { |
| 87 | if (filePath && fs.existsSync(filePath)) { |