fix: Ensure history ID is returned from database insert, call original task_done last
This commit is contained in:
+2
-2
@@ -135,7 +135,7 @@ class QueueDatabase:
|
||||
outputs: Optional[dict],
|
||||
status: str,
|
||||
duration_seconds: Optional[float] = None,
|
||||
) -> None:
|
||||
) -> int:
|
||||
with self._get_conn() as conn:
|
||||
# Prefer accurate timestamps from queue_items when available
|
||||
def _parse_dt(val: Any) -> Optional[datetime]:
|
||||
@@ -179,7 +179,7 @@ class QueueDatabase:
|
||||
if completed_at is None:
|
||||
completed_at = created_at
|
||||
|
||||
conn.execute(
|
||||
cur = conn.execute(
|
||||
'''
|
||||
INSERT INTO job_history (prompt_id, workflow, outputs, duration_seconds, created_at, completed_at, status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
|
||||
@@ -69,7 +69,6 @@ class PersistentQueueManager:
|
||||
def task_done_wrapper(q_self, item_id, history_result, status):
|
||||
# Capture before original pops it
|
||||
item = q_self.currently_running.get(item_id)
|
||||
self._original_task_done(q_self, item_id, history_result, status)
|
||||
try:
|
||||
if item is not None:
|
||||
prompt_id = item[1]
|
||||
|
||||
Reference in New Issue
Block a user