only re-reflect streams if the sd blob is readable

This commit is contained in:
Jack Robison 2019-04-18 14:39:02 -04:00
parent d5a353066c
commit a0e3338177
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -185,14 +185,15 @@ class StreamManager:
batch = [] batch = []
while sd_hashes: while sd_hashes:
stream = self.streams[sd_hashes.pop()] stream = self.streams[sd_hashes.pop()]
if self.blob_manager.get_blob(stream.sd_hash).get_is_verified() and stream.blobs_completed:
if not stream.fully_reflected.is_set(): if not stream.fully_reflected.is_set():
host, port = random.choice(self.config.reflector_servers) host, port = random.choice(self.config.reflector_servers)
batch.append(stream.upload_to_reflector(host, port)) batch.append(stream.upload_to_reflector(host, port))
if len(batch) >= self.config.concurrent_reflector_uploads: if len(batch) >= self.config.concurrent_reflector_uploads:
await asyncio.gather(*batch) await asyncio.gather(*batch, loop=self.loop)
batch = [] batch = []
if batch: if batch:
await asyncio.gather(*batch) await asyncio.gather(*batch, loop=self.loop)
await asyncio.sleep(300, loop=self.loop) await asyncio.sleep(300, loop=self.loop)
async def start(self): async def start(self):