X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FV2Writable.pm;h=6021de4496a5e08b2504bbf5498a0d0d112427c6;hb=55b707d788ce13696e4411389583e720ea6dab01;hp=ab80941acb64431537b54029613bb42d62776f71;hpb=f425bacfb75db2c454a6bc7b0a0845e7520e0a48;p=public-inbox.git diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index ab80941a..6021de44 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -18,7 +18,7 @@ use PublicInbox::OverIdx; use PublicInbox::Msgmap; use PublicInbox::Spawn qw(spawn); use PublicInbox::SearchIdx; -use IO::Handle; +use IO::Handle; # ->autoflush use File::Temp qw(tempfile); # an estimate of the post-packed size to the raw uncompressed size @@ -62,10 +62,13 @@ sub count_shards ($) { # Also, shard count may change while -watch is running # due to "xcpdb --reshard" if (-d $xpfx) { + require PublicInbox::Search; + PublicInbox::Search::load_xapian(); + my $XapianDatabase = $PublicInbox::Search::X{Database}; foreach my $shard (<$xpfx/*>) { -d $shard && $shard =~ m!/[0-9]+\z! or next; eval { - Search::Xapian::Database->new($shard)->close; + $XapianDatabase->new($shard)->close; $n++; }; } @@ -470,7 +473,7 @@ sub git_hash_raw ($$) { my ($r, $w); pipe($r, $w) or die "failed to create pipe: $!"; - my $rdr = { 0 => fileno($tmp_fh), 1 => fileno($w) }; + my $rdr = { 0 => $tmp_fh, 1 => $w }; my $git_dir = $self->{-inbox}->git->{git_dir}; my $cmd = ['git', "--git-dir=$git_dir", qw(hash-object --stdin)]; my $pid = spawn($cmd, undef, $rdr);