about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiOverview.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiOverview.pm')
-rw-r--r--lib/PublicInbox/LeiOverview.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm
index 2d3db9f4..0529bbe4 100644
--- a/lib/PublicInbox/LeiOverview.pm
+++ b/lib/PublicInbox/LeiOverview.pm
@@ -41,8 +41,8 @@ sub detect_fmt ($) {
         my ($dst) = @_;
         if ($dst =~ m!\A([:/]+://)!) {
                 die "$1 support not implemented, yet\n";
-        } elsif (!-e $dst || -d _) {
-                'maildir'; # the default TODO: MH?
+        } elsif (!-e $dst || -d _) { # maildir is the default TODO: MH
+                -e "$dst/inbox.lock" ? 'v2' : 'maildir';
         } elsif (-f _ || -p _) {
                 die "unable to determine mbox family of $dst\n";
         } else {
@@ -143,7 +143,7 @@ sub _unbless_smsg {
         $smsg->{dt} = iso8601(delete $smsg->{ds}); # JMAP UTCDate
         $smsg->{pct} = get_pct($mitem) if $mitem;
         if (my $r = delete $smsg->{references}) {
-                $smsg->{refs} = [ map { $_ } ($r =~ m/$MID_EXTRACT/go) ];
+                @{$smsg->{refs}} = ($r =~ m/$MID_EXTRACT/go);
         }
         if (my $m = delete($smsg->{mid})) {
                 $smsg->{'m'} = $m;
@@ -212,7 +212,8 @@ sub ovv_each_smsg_cb { # runs in wq worker usually
                 sub {
                         my ($smsg, $mitem, $eml) = @_;
                         $smsg->{pct} = get_pct($mitem) if $mitem;
-                        $l2m->wq_io_do('write_mail', [], $smsg, $eml);
+                        eval { $l2m->wq_io_do('write_mail', [], $smsg, $eml) };
+                        $lei->fail($@) if $@ && !$!{ECONNRESET} && !$!{EPIPE};
                 }
         } elsif ($self->{fmt} =~ /\A(concat)?json\z/ && $lei->{opt}->{pretty}) {
                 my $EOR = ($1//'') eq 'concat' ? "\n}" : "\n},";