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

Loading…
Cancel
Save