From 5cb04b86a0eb6dc51f29ab4796156014e175d17a Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sat, 21 Aug 2021 00:23:27 -0400 Subject: [PATCH] shuffle() needs custom random, removed loop from Event()/Queue() --- lbry/stream/managed_stream.py | 2 +- lbry/wallet/coinselection.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lbry/stream/managed_stream.py b/lbry/stream/managed_stream.py index a6be77ce4..6f12bb63f 100644 --- a/lbry/stream/managed_stream.py +++ b/lbry/stream/managed_stream.py @@ -279,7 +279,7 @@ class ManagedStream(ManagedDownloadSource): log.info("finished saving file for lbry://%s#%s (sd hash %s...) -> %s", self.claim_name, self.claim_id, self.sd_hash[:6], self.full_path) await self.blob_manager.storage.set_saved_file(self.stream_hash) - except Exception as err: + except (Exception, asyncio.CancelledError) as err: if os.path.isfile(output_path): log.warning("removing incomplete download %s for %s", output_path, self.sd_hash) os.remove(output_path) diff --git a/lbry/wallet/coinselection.py b/lbry/wallet/coinselection.py index 908406300..6c49cf5ef 100644 --- a/lbry/wallet/coinselection.py +++ b/lbry/wallet/coinselection.py @@ -141,7 +141,7 @@ class CoinSelector: _) -> List[OutputEffectiveAmountEstimator]: """ Accumulate UTXOs at random until there is enough to cover the target. """ target = self.target + self.cost_of_change - self.random.shuffle(txos) + self.random.shuffle(txos, random=self.random.random) selection = [] amount = 0 for coin in txos: