From a49f479a5ff1be4808dff0923c9724aad4b28d3e Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 14 Feb 2019 17:35:06 -0300 Subject: [PATCH] move wait to where its needed on assembler --- lbrynet/stream/assembler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lbrynet/stream/assembler.py b/lbrynet/stream/assembler.py index e8edf60f8..a972b791f 100644 --- a/lbrynet/stream/assembler.py +++ b/lbrynet/stream/assembler.py @@ -119,16 +119,16 @@ class StreamAssembler: self.descriptor.sd_hash) continue finally: - if save_tasks: - await asyncio.wait(save_tasks) if written_blobs == len(self.descriptor.blobs) - 2: log.debug("finished decrypting and assembling stream") + if save_tasks: + await asyncio.wait(save_tasks) await self.after_finished() self.stream_finished_event.set() else: log.debug("stream decryption and assembly did not finish (%i/%i blobs are done)", written_blobs or 0, len(self.descriptor.blobs) - 2) - if self.stream_handle is not None and self.output_path is not None: + if self.output_path and os.path.isfile(self.output_path): log.debug("erasing incomplete file assembly: %s", self.output_path) os.unlink(self.output_path)