fix: mark aborted multipart jobs cancelled

This commit is contained in:
hailt 2026-11-12 23:12:45 +07:00
parent 9dd5f386ce
commit 35ce96fb56

View file

@ -122,4 +122,15 @@ async def abort_multipart(project_id: str, body: MultipartAbort,
db: AsyncSession = Depends(get_session)):
await _project_slug(project_id, db)
r2.abort_multipart(body.key, body.uploadId)
item = (await db.execute(select(UploadItem).where(
UploadItem.project_id == project_id,
UploadItem.r2_key == body.key,
UploadItem.multipart_upload_id == body.uploadId
))).scalar_one_or_none()
if item is not None:
item.status = "cancelled"
job = await db.get(UploadJob, item.job_id)
if job is not None:
job.status = "cancelled"
await db.commit()
return {"aborted": True}