Taking ~40s to synchronize a ~75K message IMAP folder is
still a lot of time, so support an option to only touch
new messages.
This is similar to "offlineimap -q" (quick) or "mbsync --new"
switches, but lei already accepts "-q" as a shortcut for
--quiet. "--new" could work, but "--new-only" might be more
descriptive (or "--only-new"?), since the default fetches
also fetches new messages.
v2: warn for non-IMAP sources, I'm not sure it's worth it for
Maildir or other sources, yet. It will also make sense
for MH and JMAP once we support them.
@c_opt ],
'import' => [ 'LOCATION...|--stdin',
'one-time import/update from URL or filesystem',
@c_opt ],
'import' => [ 'LOCATION...|--stdin',
'one-time import/update from URL or filesystem',
- qw(stdin| offset=i recursive|r exclude=s include|I=s jobs=s
+ qw(stdin| offset=i recursive|r exclude=s include|I=s jobs=s new-only
lock=s@ in-format|F=s kw! verbose|v+ incremental! mail-sync!),
qw(no-torsocks torsocks=s), PublicInbox::LeiQuery::curl_opt(), @c_opt ],
'forget-mail-sync' => [ 'LOCATION...',
lock=s@ in-format|F=s kw! verbose|v+ incremental! mail-sync!),
qw(no-torsocks torsocks=s), PublicInbox::LeiQuery::curl_opt(), @c_opt ],
'forget-mail-sync' => [ 'LOCATION...',
$j =~ /\A([0-9]+),[0-9]+\z/ and $j = $1 + 0;
$j ||= scalar(@{$self->{inputs}}) || 1;
my $ikw;
$j =~ /\A([0-9]+),[0-9]+\z/ and $j = $1 + 0;
$j ||= scalar(@{$self->{inputs}}) || 1;
my $ikw;
- if (my $net = $lei->{net}) {
+ my $net = $lei->{net};
+ if ($net) {
# $j = $net->net_concurrency($j); TODO
if ($lei->{opt}->{incremental} // 1) {
$net->{incremental} = 1;
$net->{-lms_ro} = $sto->search->lms // 0;
if ($self->{-import_kw} && $net->{-lms_ro} &&
# $j = $net->net_concurrency($j); TODO
if ($lei->{opt}->{incremental} // 1) {
$net->{incremental} = 1;
$net->{-lms_ro} = $sto->search->lms // 0;
if ($self->{-import_kw} && $net->{-lms_ro} &&
+ !$lei->{opt}->{'new-only'} &&
$net->{imap_order}) {
require PublicInbox::LeiImportKw;
$ikw = PublicInbox::LeiImportKw->new($lei);
$net->{imap_order}) {
require PublicInbox::LeiImportKw;
$ikw = PublicInbox::LeiImportKw->new($lei);
my $nproc = $self->detect_nproc;
$j = $nproc if $j > $nproc;
}
my $nproc = $self->detect_nproc;
$j = $nproc if $j > $nproc;
}
+ if ($lei->{opt}->{'new-only'} && (!$net || !$net->{imap_order})) {
+ $lei->err('# --new-only is only for IMAP');
+ }
my $ops = {};
$lei->{auth}->op_merge($ops, $self) if $lei->{auth};
$self->{-wq_nr_workers} = $j // 1; # locked
my $ops = {};
$lei->{auth}->op_merge($ops, $self) if $lei->{auth};
$self->{-wq_nr_workers} = $j // 1; # locked