Skip to content

Commit

Permalink
fix: internal server error when videos not found by separately callin…
Browse files Browse the repository at this point in the history
…g fetchChannelData and fetchVideoData functions instead of gather
  • Loading branch information
jaydeepjethwa committed Mar 29, 2023
1 parent 90ed2f6 commit 4032598
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

home_view = APIRouter()

@home_view.get("/")
@home_view.get("")
async def home(request: Request):
"""Home page of the web-app.
Expand All @@ -33,14 +33,11 @@ async def home(request: Request):
credentials = request.session["credentials"]
request.session["channel_data"] = {}
try:
# fetch channel details & video data
channel_details, video_data = await asyncio.gather(
fetchChannelData(credentials),
fetchVideoData(credentials)
)

# store them in session storage
# fetch channel details & video data and store it in session storage
channel_details = await fetchChannelData(credentials)
request.session["channel_data"]["channel_details"] = channel_details

video_data = await fetchVideoData(credentials)
request.session["channel_data"]["video_data"] = video_data

except QuotaExceededError: # request quota is exceeded
Expand Down

0 comments on commit 4032598

Please sign in to comment.