summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
71f6861)
`undef' entries still take up a slot in the hash table, and
cause the `exists' check to false-positive in ->cleanup_shards.
This should fully fix the (innocuous) messages introduced in
commit
63d7b8ce (daemons: revamp periodic cleanup task, 2021-09-23)
# Make sure it's purged in that case:
$ibx->over or die "no over.sqlite3 in $ibx->{inboxdir}\n";
# Make sure it's purged in that case:
$ibx->over or die "no over.sqlite3 in $ibx->{inboxdir}\n";
- # $ibx->{search} is populated by $ibx->over call
- my $xdir_ro = $ibx->{search}->xdir(1);
+ require PublicInbox::Search;
+ my $xdir_ro = PublicInbox::Search->new($ibx)->xdir(1);
+
my $nshard = 0;
foreach my $shard (<$xdir_ro/*>) {
if (-d $shard && $shard =~ m!/[0-9]+\z!) {
my $nshard = 0;
foreach my $shard (<$xdir_ro/*>) {
if (-d $shard && $shard =~ m!/[0-9]+\z!) {
sub search {
my ($self) = @_;
sub search {
my ($self) = @_;
- my $srch = $self->{search} //= eval {
+ $self->{search} // eval {
_cleanup_later($self);
require PublicInbox::Search;
_cleanup_later($self);
require PublicInbox::Search;
- PublicInbox::Search->new($self);
+ my $srch = PublicInbox::Search->new($self);
+ (eval { $srch->xdb }) ? ($self->{search} = $srch) : undef;
- (eval { $srch->xdb }) ? $srch : undef;
}
# isrch is preferred for read-only interfaces if available since it
}
# isrch is preferred for read-only interfaces if available since it
sub over {
my ($self, $req) = @_;
sub over {
my ($self, $req) = @_;
- $self->{over} //= eval {
- my $srch = $self->{search} //= do {
- _cleanup_later($self);
+ $self->{over} // eval {
+ my $srch = $self->{search} // do {
require PublicInbox::Search;
PublicInbox::Search->new($self);
};
my $over = PublicInbox::Over->new("$srch->{xpfx}/over.sqlite3");
$over->dbh; # may fail
require PublicInbox::Search;
PublicInbox::Search->new($self);
};
my $over = PublicInbox::Over->new("$srch->{xpfx}/over.sqlite3");
$over->dbh; # may fail
} // ($req ? croak("E: $@") : undef);
}
} // ($req ? croak("E: $@") : undef);
}
sub nntp_usable {
my ($self) = @_;
my $ret = mm($self) && over($self);
sub nntp_usable {
my ($self) = @_;
my $ret = mm($self) && over($self);
- $self->{mm} = $self->{over} = $self->{search} = undef;
+ delete @$self{qw(mm over search)};
sub xdb ($) {
my ($self) = @_;
sub xdb ($) {
my ($self) = @_;
my @xdb = $self->xdb_shards_flat or return;
$self->{nshard} = scalar(@xdb);
my $xdb = shift @xdb;
$xdb->add_database($_) for @xdb;
my @xdb = $self->xdb_shards_flat or return;
$self->{nshard} = scalar(@xdb);
my $xdb = shift @xdb;
$xdb->add_database($_) for @xdb;
my ($class, $ibx) = @_;
ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
my $xap = $ibx->version > 1 ? 'xap' : 'public-inbox/xapian';
my ($class, $ibx) = @_;
ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
my $xap = $ibx->version > 1 ? 'xap' : 'public-inbox/xapian';
- bless {
- xpfx => "$ibx->{inboxdir}/$xap" . SCHEMA_VERSION,
- altid => $ibx->{altid},
- }, $class;
+ my $xpfx = "$ibx->{inboxdir}/$xap".SCHEMA_VERSION;
+ my $self = bless { xpfx => $xpfx }, $class;
+ $self->{altid} = $ibx->{altid} if defined($ibx->{altid});
+ $self;