foreach my $mid (@$mids) {
$tg->index_text($mid, 1, 'XM');
+
+ # because too many Message-IDs are prefixed with
+ # "Pine.LNX."...
+ if ($mid =~ /\w{12,}/) {
+ my @long = ($mid =~ /(\w{3,}+)/g);
+ $tg->index_text(join(' ', @long), 1, 'XM');
+ }
$tg->increase_termpos;
}
$smsg->{to} = $smsg->{cc} = '';
my %D;
my $line;
my $newest;
- my $mid = '20170114215743.5igbjup6qpsh3jfg@genre.crustytoothpaste.net';
while (defined($line = <$log>)) {
if ($line =~ /$addmsg/o) {
my $blob = $1;
delete $D{$blob} and next;
my $mime = do_cat_mail($git, $blob, \$bytes) or next;
- my $mids = mids($mime->header_obj);
- foreach (@$mids) {
- warn "ADD $mid\n" if ($_ eq $mid);
- }
batch_adjust(\$max, $bytes, $batch_cb, $latest);
$add_cb->($self, $mime, $bytes, $blob);
} elsif ($line =~ /$delmsg/o) {
# get the leftovers
foreach my $blob (keys %D) {
my $mime = do_cat_mail($git, $blob, \$bytes) or next;
- my $mids = mids($mime->header_obj);
- foreach (@$mids) {
- warn "DEL $mid\n" if ($_ eq $mid);
- }
$del_cb->($self, $mime);
}
$batch_cb->($latest, $newest);
}
}
$self->commit_txn_lazy;
+ $xdb = _xdb_release($self);
# let another process do some work... <
if (!$newest) {
$xdb = $self->begin_txn_lazy;
sub begin_txn_lazy {
my ($self) = @_;
return if $self->{txn};
- my $xdb = $self->{xdb} || $self->_xdb_acquire;
- $self->{over}->begin_lazy if $self->{over};
- $xdb->begin_transaction;
- $self->{txn} = 1;
- $xdb;
+
+ $self->{-inbox}->with_umask(sub {
+ my $xdb = $self->{xdb} || $self->_xdb_acquire;
+ $self->{over}->begin_lazy if $self->{over};
+ $xdb->begin_transaction;
+ $self->{txn} = 1;
+ $xdb;
+ });
}
sub commit_txn_lazy {
my ($self) = @_;
delete $self->{txn} or return;
- $self->{xdb}->commit_transaction;
- $self->{over}->commit_lazy if $self->{over};
+ $self->{-inbox}->with_umask(sub {
+ $self->{xdb}->commit_transaction;
+ $self->{over}->commit_lazy if $self->{over};
+ });
}
sub worker_done {