simplify queue ops, handle broken pipe errors
- Add OSError errno 32 (broken pipe) handling in progress broadcast - Remove progress service calls from add/clear queue operations - Add pending_by_episode cleanup on clear - Update tests accordingly
This commit is contained in:
@@ -229,7 +229,7 @@ async def clear_pending(
|
||||
)
|
||||
|
||||
|
||||
@router.delete("/{item_id}", status_code=status.HTTP_204_NO_CONTENT)
|
||||
@router.delete("/{item_id}", status_code=status.HTTP_200_OK)
|
||||
async def remove_from_queue(
|
||||
item_id: str = Path(..., description="Download item ID to remove"),
|
||||
_: dict = Depends(require_auth),
|
||||
@@ -246,6 +246,9 @@ async def remove_from_queue(
|
||||
Args:
|
||||
item_id: Unique identifier of the download item to remove
|
||||
|
||||
Returns:
|
||||
dict: Status message confirming removal
|
||||
|
||||
Raises:
|
||||
HTTPException: 401 if not authenticated, 404 if item not found,
|
||||
500 on service error
|
||||
@@ -260,6 +263,12 @@ async def remove_from_queue(
|
||||
resource_id=item_id
|
||||
)
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Removed item {item_id} from queue",
|
||||
"removed_id": item_id,
|
||||
}
|
||||
|
||||
except DownloadServiceError as e:
|
||||
raise BadRequestError(message=str(e))
|
||||
except (BadRequestError, NotFoundError, ServerError):
|
||||
|
||||
Reference in New Issue
Block a user