transcode checker: longer retry while waiting for videos to finish

but still check db often.
This prevents us from using too much api quota on these checks,
while still letting us spot new videos quickly.
pull/66/head
Mike Lang 5 years ago committed by Christopher Usher
parent 1f15900b6f
commit e4d3e418c8

@ -400,8 +400,9 @@ class Cutter(object):
class TranscodeChecker(object): class TranscodeChecker(object):
NO_VIDEOS_RETRY_INTERVAL = 5 NO_VIDEOS_RETRY_INTERVAL = 5 # can be fast because it's just a DB lookup
ERROR_RETRY_INTERVAL = 5 FOUND_VIDEOS_RETRY_INTERVAL = 20
ERROR_RETRY_INTERVAL = 20
def __init__(self, youtube, dbmanager, stop): def __init__(self, youtube, dbmanager, stop):
""" """
@ -428,12 +429,11 @@ class TranscodeChecker(object):
continue continue
self.logger.info("Found {} videos in TRANSCODING".format(len(ids))) self.logger.info("Found {} videos in TRANSCODING".format(len(ids)))
ids = self.check_ids(ids) ids = self.check_ids(ids)
if not ids: if ids:
self.wait(self.NO_VIDEOS_RETRY_INTERVAL) self.logger.info("{} videos are done".format(len(ids)))
continue done = self.mark_done(ids)
self.logger.info("{} videos are done".format(len(ids))) self.logger.info("Marked {} videos as done".format(done))
done = self.mark_done(ids) self.wait(self.FOUND_VIDEOS_RETRY_INTERVAL)
self.logger.info("Marked {} videos as done".format(done))
except Exception: except Exception:
self.logger.exception("Error in TranscodeChecker") self.logger.exception("Error in TranscodeChecker")
# To ensure a fresh slate and clear any DB-related errors, get a new conn on error. # To ensure a fresh slate and clear any DB-related errors, get a new conn on error.

Loading…
Cancel
Save