diff options
author | Eric Wong <e@80x24.org> | 2021-08-17 08:52:41 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-08-18 11:41:33 +0000 |
commit | 706888be614a26b91be75d39578b9db26772bd00 (patch) | |
tree | c68446d00842eb32d519145e886c6cb1066b5fba /lib | |
parent | 77d030df1d292a99291371b3649cff3657fd93c8 (diff) | |
download | public-inbox-706888be614a26b91be75d39578b9db26772bd00.tar.gz |
As implied in commit 6ff03ba2be9247f1 ("lei export-kw: do not write directly to mail_sync.sqlite3"), modifying mail_sync.sqlite3 directly can lead to conflicts and making everything go through lei/store is easier.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/LeiForgetMailSync.pm | 8 | ||||
-rw-r--r-- | lib/PublicInbox/LeiStore.pm | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiForgetMailSync.pm b/lib/PublicInbox/LeiForgetMailSync.pm index c74ba25d..940ca1b6 100644 --- a/lib/PublicInbox/LeiForgetMailSync.pm +++ b/lib/PublicInbox/LeiForgetMailSync.pm @@ -15,13 +15,13 @@ use PublicInbox::LeiExportKw; sub lei_forget_mail_sync { my ($lei, @folders) = @_; my $lms = $lei->lms or return; + my $sto = $lei->_lei_store or return; # may disappear due to race + $sto->write_prepare; my $err = $lms->arg2folder($lei, \@folders); $lei->qerr(@{$err->{qerr}}) if $err->{qerr}; return $lei->fail($err->{fail}) if $err->{fail}; - delete $lms->{dbh}; - $lms->lms_begin; - $lms->forget_folder($_) for @folders; - $lms->lms_commit; + $sto->ipc_do('lms_forget_folders', @folders); + my $wait = $sto->ipc_do('done'); } *_complete_forget_mail_sync = \&PublicInbox::LeiExportKw::_complete_export_kw; diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 3f33d114..e8334187 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -216,6 +216,12 @@ sub lms_mv_src { _lms_rw($self)->mv_src($folder, $oidbin, $id, $newbn); } +sub lms_forget_folders { + my ($self, @folders) = @_; + my $lms = _lms_rw($self); + for my $f (@folders) { $lms->forget_folder($f) } +} + sub set_sync_info { my ($self, $oidhex, $folder, $id) = @_; _lms_rw($self)->set_src($oidhex, $folder, $id); |