Skip to content
Snippets Groups Projects
Unverified Commit 61306c8f authored by Gregory Martin's avatar Gregory Martin Committed by GitHub
Browse files

Merge pull request #17377 from edx/fysheets/EDUCATOR-2230

Update video record handling defensiveness
parents bc790400 61b8bd4d
No related merge requests found
......@@ -6,6 +6,7 @@ import json
import logging
from contextlib import closing
from datetime import datetime, timedelta
from pytz import UTC
from uuid import uuid4
import rfc6266
......@@ -505,7 +506,11 @@ def convert_video_status(video):
* `YouTube Duplicate` if status is `invalid_token`
* user-friendly video status
"""
now = datetime.now(video['created'].tzinfo)
try:
# Protect against legacy incomplete edx-val edx_video_id records.
now = datetime.now(video['created'].tzinfo)
except AttributeError:
now = datetime.now().replace(tzinfo=UTC)
if video['status'] == 'upload' and (now - video['created']) > timedelta(hours=MAX_UPLOAD_HOURS):
new_status = 'upload_failed'
status = StatusDisplayStrings.get(new_status)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment