mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-10-01 04:51:53 +02:00
A job that had just started, with in_progress=1 and no checkpoint yet, matched findInterruptedJobs immediately. Since #297 the middleware runs that check on every request, so a live job was "resumed" by recovery while the original process was still working on the same repositories. The request-level 15 second timeout then released the in-flight latch without cancelling recovery, and later requests logged misleading "already in progress" and "completed with some issues" lines. - Move the liveness rule into interrupted-job-detection.ts, as both a predicate and the SQL condition used by findInterruptedJobs. A job with no checkpoint is only interrupted once it is older than the 10 minute checkpoint window (or has no recorded start at all). - Stamp an initial checkpoint on in-progress jobs at creation. - Refresh the checkpoint every 2 minutes from processWithResilience so a single long item cannot make a live job look interrupted. The refresh only touches rows still in progress. - Keep the middleware recovery latch held until the recovery promise settles, not until the request stops waiting, and clear the timeout timer so it no longer leaves a dangling rejection. Tests cover the predicate, the SQL against an in-memory SQLite database, and the wiring into helpers, concurrency, and middleware. Claude-Session: https://claude.ai/code/session_01Tp9pmi65a8k5jLMQFLf4JX