downloader: Don't check the age of a worker we just spawned

Not only is this redundant, but it creates a race condition where
the worker fails before the latest_worker = workers[-1] check,
and we get an IndexError.
pull/157/head
Mike Lang 5 years ago
parent 3fabb2944f
commit 72003f28d0

@ -219,6 +219,7 @@ class StreamsManager(object):
if not workers and quality in self.latest_urls: if not workers and quality in self.latest_urls:
self.logger.info("Starting new worker for {} as none exist".format(quality)) self.logger.info("Starting new worker for {} as none exist".format(quality))
self.start_worker(quality) self.start_worker(quality)
continue
latest_worker = workers[-1] latest_worker = workers[-1]
# is the old worker too old? # is the old worker too old?
if latest_worker.age() > self.MAX_WORKER_AGE: if latest_worker.age() > self.MAX_WORKER_AGE:

Loading…
Cancel
Save