AttributeError: 'NoneType' object has no attribute 'timestamp'

This commit is contained in:
yongtenglei 2025-12-02 14:06:03 +08:00
parent 3d3002895f
commit 3c3cc95a62

View file

@ -719,10 +719,14 @@ class DocumentService(CommonService):
# only for special task and parsed docs and unfinished
freeze_progress = special_task_running and doc_progress >= 1 and not finished
msg = "\n".join(sorted(msg))
begin_at = d.get("process_begin_at")
if not begin_at:
begin_at = datetime.now()
# fallback
cls.update_by_id(d["id"], {"process_begin_at": begin_at})
info = {
"process_duration": datetime.timestamp(
datetime.now()) -
d["process_begin_at"].timestamp(),
"process_duration": max(datetime.timestamp(datetime.now()) - begin_at.timestamp(), 0),
"run": status}
if prg != 0 and not freeze_progress:
info["progress"] = prg