Age a stalled transfer from created_at when started_at is missing
The stall clock read started_at and returned zero when it was absent, which exempted every row written before that column existed -- precisely the jobs that have been stuck the longest. The live instance had one: a `downloading` job from before the upgrade, its transfer parked in Queued, Remotely, which the new check would have skipped forever. Falls back to created_at, which for a job still in `downloading` is the same question asked a slightly different way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e1b7b69261
commit
39b0e0bb33
2 files changed
+18
-5
No files matched your search
@@ -1261,8 +1261,16 @@ def transfer_index(payload: list) -> dict[str, dict]:
|
||||
|
||||
|
||||
def stalled_for(job: sqlite3.Row) -> float:
|
||||
"""Minutes since this transfer last had anything to show for itself."""
|
||||
started = job["started_at"] if "started_at" in job.keys() else None
|
||||
"""Minutes since this transfer last had anything to show for itself.
|
||||
|
||||
Falls back to created_at, which is what makes this work on rows written
|
||||
before started_at existed. Those are `downloading` with no clock at all,
|
||||
so returning zero for them would exempt precisely the jobs that have been
|
||||
stuck the longest -- the ones this check exists to catch.
|
||||
"""
|
||||
keys = job.keys()
|
||||
started = ((job["started_at"] if "started_at" in keys else None)
|
||||
or (job["created_at"] if "created_at" in keys else None))
|
||||
if not started:
|
||||
return 0.0
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user