Unverified Commit 40459a09 authored by Andreas Valder's avatar Andreas Valder
Browse files

throw exception if the video hash missmatches and log exceptions to mail

parent 50ac6417
from server import modify, query, date_json_handler, sched_func
from server import modify, query, date_json_handler, sched_func, notify_admins
from datetime import datetime, timedelta
import traceback
import json
......@@ -22,6 +22,7 @@ def job_handler_handle(id, state):
try:
func(id, job['type'], json.loads(job['data']), state, json.loads(job['status']))
except Exception:
notify_admins('scheduler_exception', name=func.__name__, traceback=traceback.format_exc())
traceback.print_exc()
@sched_func(10)
......
......@@ -35,8 +35,7 @@ def update_video_metadata(jobid, jobtype, data, state, status):
if jobtype not in ['remux', 'transcode']:
video = query('SELECT * FROM videos WHERE id = ?', data['video_id'])[0]
if video['hash'] and video['hash'] != status['hash']:
print('Hash mismatch for video', data['video_id'])
return
raise Exception('Hash mismatch for video {}'.format(data['video_id']))
modify('UPDATE videos_data SET hash = ?, file_size = ?, duration = ? WHERE id = ?',
status['hash'], status['filesize'], status['duration'], data['video_id'])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment