sub check_batch_limit ($) {
my ($req) = @_;
# set flag for PublicInbox::V2Writable::index_todo:
- update_checkpoint $req->{self}, $req->{new_smsg} and
+ update_checkpoint $req->{self}, $req->{new_smsg}->{bytes} and
${$req->{need_checkpoint}} = 1;
}
}
sub update_checkpoint ($$) {
- my ($self, $smsg) = @_;
- ($self->{transact_bytes} += $smsg->{bytes}) >= $self->{batch_bytes} and
+ my ($self, $bytes) = @_;
+ ($self->{transact_bytes} += $bytes) >= $self->{batch_bytes} and
return 1;
my $now = now;
my $next = $self->{next_checkpoint} //= $now + $CHECKPOINT_INTVL;
my $smsg = bless { blob => $oid }, 'PublicInbox::Smsg';
$smsg->set_bytes($$bref, $size);
my $self = $sync->{sidx};
- ${$sync->{need_checkpoint}} = 1 if update_checkpoint $self, $smsg;
+ ${$sync->{need_checkpoint}} = 1 if update_checkpoint $self, $smsg->{bytes};
local $self->{current_info} = "$self->{current_info}: $oid";
my $eml = PublicInbox::Eml->new($bref);
$smsg->{num} = index_mm($self, $eml, $oid, $sync) or
my $idx = idx_shard($self, $smsg->{num});
$idx->index_eml($eml, $smsg);
}
- update_checkpoint $self, $smsg;
+ update_checkpoint $self, $smsg->{bytes};
}
# returns undef on duplicate or spam