Browse Source

lock inside read, ignore unreadable files

master
Volker Birk 6 years ago
parent
commit
0b9488c2af
  1. 21
      test/minimail.py

21
test/minimail.py

@ -53,14 +53,17 @@ def newer(file1, file2=None):
def recv_all(inbox, marker): def recv_all(inbox, marker):
with Lock(inbox): r = []
r = [] while not r:
while not r: for f in compress(inbox.glob("*.eml"), partial(newer, file2=marker)):
for f in compress(inbox.glob("*.eml"), partial(newer, file2=marker)): with Lock(inbox):
t = f.readall() try:
r.append(t) t = f.readall()
if not r: r.append(t)
sleep(1) except:
marker.touch(exist_ok=True) pass
if not r:
sleep(1)
marker.touch(exist_ok=True)
return r return r

Loading…
Cancel
Save