mirror of
https://github.com/chatmail/relay.git
synced 2026-05-17 16:38:59 +00:00
fixup after testing on nine:
- don't remove large files already after 7 days if they are in the "new/" folder - report which mailbox is being checked so that "journalctl -u chatmail-expire.service" provides sufficient output for checking - don't trigger expiry or fsreport services during cmdeploy-run but run it from timer only
This commit is contained in:
@@ -105,12 +105,17 @@ class Expiry:
|
||||
|
||||
# all to-be-removed files are relative to the mailbox basedir
|
||||
os.chdir(mbox.basedir)
|
||||
mboxname = os.path.basename(mbox.basedir)
|
||||
if self.verbose:
|
||||
print_info(f"checking for mailbox messages in: {mboxname}")
|
||||
self.all_files += len(mbox.messages)
|
||||
for message in mbox.messages:
|
||||
if message.mtime < cutoff_mails:
|
||||
self.remove_file(message.relpath)
|
||||
elif message.size > 200000 and message.mtime < cutoff_large_mails:
|
||||
self.remove_file(message.relpath)
|
||||
# we only remove noticed large files (not unnoticed ones in new/)
|
||||
if message.relpath.startswith("cur/"):
|
||||
self.remove_file(message.relpath)
|
||||
else:
|
||||
continue
|
||||
changed = True
|
||||
|
||||
@@ -123,6 +123,7 @@ def test_expiry_cli_old_files(capsys, example_config, mbox1):
|
||||
if fnmatch(line, f"removing*{path}"):
|
||||
break
|
||||
else:
|
||||
pytest.fail(f"failed to remove {path}\n{err}")
|
||||
if path != "new/msg_old_large2":
|
||||
pytest.fail(f"failed to remove {path}\n{err}")
|
||||
|
||||
assert "shouldstay" not in err
|
||||
|
||||
Reference in New Issue
Block a user