From 0b9488c2af5837517b995db1c98589462e849ee9 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Sun, 24 Feb 2019 09:56:13 +0100 Subject: [PATCH] lock inside read, ignore unreadable files --- test/minimail.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/minimail.py b/test/minimail.py index bb89a64..87eda7a 100644 --- a/test/minimail.py +++ b/test/minimail.py @@ -53,14 +53,17 @@ def newer(file1, file2=None): def recv_all(inbox, marker): - with Lock(inbox): - r = [] - while not r: - for f in compress(inbox.glob("*.eml"), partial(newer, file2=marker)): - t = f.readall() - r.append(t) - if not r: - sleep(1) - marker.touch(exist_ok=True) + r = [] + while not r: + for f in compress(inbox.glob("*.eml"), partial(newer, file2=marker)): + with Lock(inbox): + try: + t = f.readall() + r.append(t) + except: + pass + if not r: + sleep(1) + marker.touch(exist_ok=True) return r