fix reflect_streams not being followed

This commit is contained in:
Jack Robison 2019-02-08 20:13:26 -05:00
parent 0c93090d2c
commit 6386815a29
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -168,7 +168,7 @@ class StreamManager:
async def reflect_streams(self): async def reflect_streams(self):
while True: while True:
if self.config.reflector_servers: if self.config.reflect_streams and self.config.reflector_servers:
sd_hashes = await self.storage.get_streams_to_re_reflect() sd_hashes = await self.storage.get_streams_to_re_reflect()
streams = list(filter(lambda s: s.sd_hash in sd_hashes, self.streams)) streams = list(filter(lambda s: s.sd_hash in sd_hashes, self.streams))
batch = [] batch = []
@ -205,7 +205,7 @@ class StreamManager:
stream = await ManagedStream.create(self.loop, self.blob_manager, file_path, key, iv_generator) stream = await ManagedStream.create(self.loop, self.blob_manager, file_path, key, iv_generator)
self.streams.add(stream) self.streams.add(stream)
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream) self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
if self.config.reflector_servers: if self.config.reflect_streams and self.config.reflector_servers:
host, port = random.choice(self.config.reflector_servers) host, port = random.choice(self.config.reflector_servers)
self.loop.create_task(stream.upload_to_reflector(host, port)) self.loop.create_task(stream.upload_to_reflector(host, port))
return stream return stream