user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] lei_to_mail: only run lms_write_prepare for IMAP+Maildir
@ 2021-10-26 10:47 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-10-26 10:47 UTC (permalink / raw)
  To: meta

Mail synchronization in lei_to_mail only works for IMAP and
Maildir; so don't waste time preparing mbox* writers for it.
---
 lib/PublicInbox/LeiToMail.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index e7220bf02954..83f58a29405b 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -282,6 +282,7 @@ sub _maildir_write_cb ($$) {
 	my $lse = $lei->{lse}; # may be undef
 	my $lms = $self->{-lms_rw};
 	my $out = $lms ? 'maildir:'.$lei->abs_path($dst) : undef;
+	$lms->lms_write_prepare if $lms;
 
 	# Favor cur/ and only write to new/ when augmenting.  This
 	# saves MUAs from having to do a mass rename when the initial
@@ -312,6 +313,7 @@ sub _imap_write_cb ($$) {
 	$uri->uidvalidity($mic->uidvalidity($folder));
 	my $lse = $lei->{lse}; # may be undef
 	my $lms = $self->{-lms_rw};
+	$lms->lms_write_prepare if $lms;
 	sub { # for git_to_mail
 		my ($bref, $smsg, $eml) = @_;
 		$mic // return $lei->fail; # mic may be undef-ed in last run
@@ -750,7 +752,6 @@ sub ipc_atfork_child {
 	my ($self) = @_;
 	my $lei = $self->{lei};
 	$lei->_lei_atfork_child;
-	$self->{-lms_rw}->lms_write_prepare if $self->{-lms_rw};
 	$lei->{auth}->do_auth_atfork($self) if $lei->{auth};
 	$SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb();
 	$self->SUPER::ipc_atfork_child;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-26 10:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 10:47 [PATCH] lei_to_mail: only run lms_write_prepare for IMAP+Maildir Eric Wong

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).