resume streams on startup

This commit is contained in:
Victor Shyba 2019-02-03 20:39:01 -03:00
parent 11bb1cc7ee
commit 736a949cb5

View file

@ -142,11 +142,12 @@ class StreamManager:
log.warning("no DHT node given, cannot resume downloads") log.warning("no DHT node given, cannot resume downloads")
return return
await self.node.joined.wait() await self.node.joined.wait()
resumed = 0 t = [
t = [self.start_stream(stream) for stream in self.streams if stream.status == ManagedStream.STATUS_RUNNING] stream.start_download(self.node)
if resumed: for stream in self.streams if stream.status == ManagedStream.STATUS_RUNNING
log.info("resuming %i downloads", t) ]
await asyncio.gather(*t, loop=self.loop) if t:
log.info("resuming %i downloads", len(t))
async def reflect_streams(self): async def reflect_streams(self):
while True: while True: