fix: mark aborted multipart jobs cancelled
This commit is contained in:
parent
9dd5f386ce
commit
35ce96fb56
1 changed files with 11 additions and 0 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue