|
|
@ -55,15 +55,15 @@ def newer(file1, file2=None): |
|
|
|
def recv_all(inbox, marker): |
|
|
|
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 |
|
|
|
for p in inbox.glob("*.eml"): |
|
|
|
if newer(p, inbox / marker): |
|
|
|
with Lock(inbox): |
|
|
|
with open(p, "rb") as f: |
|
|
|
t = f.read(-1) |
|
|
|
r.append(t) |
|
|
|
if not r: |
|
|
|
sleep(1) |
|
|
|
marker.touch(exist_ok=True) |
|
|
|
|
|
|
|
(inbox / marker).touch(exist_ok=True) |
|
|
|
return r |
|
|
|
|
|
|
|