about summary refs log tree commit homepage
path: root/lib/PublicInbox/V2Writable.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r--lib/PublicInbox/V2Writable.pm10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 567582c5..edb8ba57 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -24,7 +24,7 @@ use File::Temp ();
 
 my $OID = qr/[a-f0-9]{40,}/;
 # an estimate of the post-packed size to the raw uncompressed size
-my $PACKING_FACTOR = 0.4;
+our $PACKING_FACTOR = 0.4;
 
 # SATA storage lags behind what CPUs are capable of, so relying on
 # nproc(1) can be misleading and having extra Xapian shards is a
@@ -73,13 +73,7 @@ sub count_shards ($) {
                 delete $ibx->{search};
                 $srch->{nshard} // 0
         } else { # ExtSearchIdx
-                $self->{nshard} // do {
-                        if ($self->xdb_sharded) {
-                                $self->{nshard} // die 'BUG: {nshard} unset';
-                        } else {
-                                0;
-                        }
-                }
+                $self->{nshard} ||= scalar($self->xdb_shards_flat);
         }
 }