Skip to content

Commit

Permalink
fix(api): return status stream directly for status endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Oct 31, 2023
1 parent d464116 commit 25d92f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions apps/api/app/routers/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ async def status_stream(request: Request, session: Session):

# Exclude from OpenAPI schema as there is no support for Server Sent Events.
@router.get('/status', include_in_schema=False)
async def get_downloads_status(
def get_downloads_status(
request: Request, session_id: str,
) -> EventSourceResponse:
session = session_manager.get(session_id)
if session is None:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
event_source = status_stream(request, session)
return EventSourceResponse(event_source)
return EventSourceResponse(status_stream(request, session))


@router.get('/{download_id}', responses=depends_download_responses)
Expand Down
2 changes: 1 addition & 1 deletion core/ydcore/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(
self, output_dir: str,
status_hook: StatusHook | None = None,
*,
num_threads: int | None = 2,
num_threads: int | None = None,
):
self._status_hook = status_hook
self._downloads: dict[str, DownloadConfig] = {}
Expand Down

1 comment on commit 25d92f5

@vercel
Copy link

@vercel vercel bot commented on 25d92f5 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.