fix: CancelledError/Exception 경로에도 DB log_completion 추가
task.cancel()로 인한 CancelledError는 streaming loop 바깥에서 잡히므로 별도 log_completion 필요 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,9 +83,17 @@ async def run(job: Job) -> None:
|
||||
except asyncio.CancelledError:
|
||||
job_manager.set_status(job.id, JobStatus.cancelled)
|
||||
await state_stream.push(job.id, "error", {"message": "작업이 취소되었습니다."})
|
||||
try:
|
||||
await log_completion(job.id, "cancelled", 0, (time() - start_time) * 1000, time())
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
logger.exception("Worker failed for job %s", job.id)
|
||||
job_manager.set_status(job.id, JobStatus.failed)
|
||||
await state_stream.push(job.id, "error", {"message": "내부 오류가 발생했습니다."})
|
||||
try:
|
||||
await log_completion(job.id, "failed", 0, (time() - start_time) * 1000, time())
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
await state_stream.push_done(job.id)
|
||||
|
||||
Reference in New Issue
Block a user