From 923e09d84e8eaa612c85f6d5ec57c3742390bebc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Apr 2021 09:46:18 +0000 Subject: lei import: avoid IMAPTracker, use LeiMailSync more IMAPTracker has a UNIQUE constraint on the `url' column, which may cause compatibility and/or rollback problems in attempting to deal with UIDVALIDITY changes. Having multiple sources of truth leads to confusion and bugs, so relying on LeiMailSync exclusively ought to simplify things. Furthermore, since LeiMailSync is only written to by LeiStore, it is safer in that it won't mark a UID or article as imported until git-fast-import has seen it, and the SQLite commit always happens after "done\n" is sent to fast-import. This mostly reverts recent commits to IMAPTracker to support lei, those are: 1) commit 7632d8f7590daf70c65d4270e750c36552fa9389 ("net_reader: restart on first UID when UIDVALIDITY changes") 2) commit 311a5d37ad275cd75b1e64d87827c4d13fe4bfab ("imap_tracker: prepare for use with lei"). This means public-inbox-watch will not change between 1.6 and 1.7: -watch stops synching a folder when UIDVALIDITY changes. --- t/lei-import-imap.t | 4 ++-- t/lei-import-nntp.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t index cf1fa49d..611328b4 100644 --- a/t/lei-import-imap.t +++ b/t/lei-import-imap.t @@ -45,8 +45,8 @@ test_lei({ tmpdir => $tmpdir }, sub { is_deeply(\%r, { 'HASH' => scalar(@$out) }, 'all hashes'); lei_ok([qw(tag +kw:seen), $url], undef, undef); - my $f = "$ENV{HOME}/.local/share/lei/store/net_last.sqlite3"; - ok(-s $f, 'net tracked for redundant imports'); + my $f = "$ENV{HOME}/.local/share/lei/store/mail_sync.sqlite3"; + ok(-s $f, 'mail_sync tracked for redundant imports'); lei_ok('inspect', "blob:$out->[5]->{blob}"); my $x = json_utf8->decode($lei_out); is(ref($x->{'lei/store'}), 'ARRAY', 'lei/store in inspect'); diff --git a/t/lei-import-nntp.t b/t/lei-import-nntp.t index d795a86a..12bb002a 100644 --- a/t/lei-import-nntp.t +++ b/t/lei-import-nntp.t @@ -27,7 +27,7 @@ test_lei({ tmpdir => $tmpdir }, sub { for (@$out) { $r{ref($_)}++ } is_deeply(\%r, { 'HASH' => scalar(@$out) }, 'all hashes'); - my $f = "$ENV{HOME}/.local/share/lei/store/net_last.sqlite3"; - ok(-s $f, 'net tracked for redundant imports'); + my $f = "$ENV{HOME}/.local/share/lei/store/mail_sync.sqlite3"; + ok(-s $f, 'mail_sync exists tracked for redundant imports'); }); done_testing; -- cgit v1.2.3-24-ge0c7