From 40a8b45231d6b3b9e9164f4b641b4663aadb0c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Fri, 20 Sep 2019 13:39:51 +0200 Subject: [PATCH] Fix concurrency issue Download_list sometimes failed with: BrokenPipeError: [Errno 32] Broken pipe --- bitter/VERSION | 2 +- bitter/utils.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bitter/VERSION b/bitter/VERSION index 85b7c69..c81aa44 100644 --- a/bitter/VERSION +++ b/bitter/VERSION @@ -1 +1 @@ -0.9.6 +0.9.7 diff --git a/bitter/utils.py b/bitter/utils.py index 856afa1..ccb605c 100644 --- a/bitter/utils.py +++ b/bitter/utils.py @@ -595,7 +595,9 @@ def download_list(wq, lst, folder, update=False, retry_failed=False, ignore_fail def gen(): while True: r = down.get() - if not r: + if r is None: + down.close() + down.join_thread() return yield r @@ -622,6 +624,8 @@ def download_list(wq, lst, folder, update=False, retry_failed=False, ignore_fail rec = done.get() if rec is None: + done.close() + done.join_thread() break oid, obj = rec