From 204e451851dfe510e16cc03e4a6ea6242c4e9076 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 27 Jun 2020 10:03:51 +0000 Subject: watch: remove {mdir} array Since we store all watched directory names as keys in %mdmap, there should be no need to keep an array of those directories around. t/watch_maildir*.t required changes to remove trained spam. Once we've trained something as spam, there shouldn't be a need to rescan it. --- t/watch_maildir.t | 2 ++ t/watch_maildir_v2.t | 2 ++ 2 files changed, 4 insertions(+) (limited to 't') diff --git a/t/watch_maildir.t b/t/watch_maildir.t index c8658140..c44273f0 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -84,6 +84,7 @@ PublicInbox::WatchMaildir->new($config)->scan('full'); is(scalar @list, 2, 'two revisions in rev-list'); @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master)); is(scalar @list, 0, 'tree is empty'); +is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam'); # check with scrubbing { @@ -105,6 +106,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); is(scalar @list, 0, 'tree is empty'); @list = $git->qx(qw(rev-list refs/heads/master)); is(scalar @list, 4, 'four revisions in rev-list'); + is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam'); } { diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t index 6cc8b6ff..f5b8e932 100644 --- a/t/watch_maildir_v2.t +++ b/t/watch_maildir_v2.t @@ -71,6 +71,7 @@ $write_spam->(); is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam'); PublicInbox::WatchMaildir->new($config)->scan('full'); is(($srch->reopen->query(''))[0], 0, 'deleted file'); +is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam'); # check with scrubbing { @@ -90,6 +91,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); PublicInbox::WatchMaildir->new($config)->scan('full'); ($nr, $msgs) = $srch->reopen->query(''); is($nr, 0, 'inbox is empty again'); + is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam'); } { -- cgit v1.2.3-24-ge0c7