about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-30 11:40:54 +0000
committerEric Wong <e@80x24.org>2023-11-30 21:36:48 +0000
commit0e784739cc8a336d7e204b50f4efc569e79461a3 (patch)
treef6d98b2142144c97ac7ad06b1a4771a83ceecd07
parent88ed7f907c5abe1a311681ea44b08c52353b711b (diff)
downloadpublic-inbox-0e784739cc8a336d7e204b50f4efc569e79461a3.tar.gz
It's possible to update the fingerprint for a given repo when we
have no commits to index on because they were already done for
another repo.  Thus we'll always vivify $repo_ctx->{active}
before calling store_repo since $active may've been undef.
-rw-r--r--lib/PublicInbox/CodeSearchIdx.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 7d696099..bd67a57e 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -613,14 +613,14 @@ sub next_repos { # OnDestroy cb
 
 sub index_done { # OnDestroy cb called when done indexing each code repo
         my ($repo_ctx, $drs) = @_;
-        my ($self, $repo, $active) = @$repo_ctx{qw(self repo active)};
-
         return if $DO_QUIT;
+        my ($self, $repo, $active) = @$repo_ctx{qw(self repo active)};
+        # $active may be undef here, but it's fine to vivify
         my $n = grep { ! $repo_ctx->{shard_ok}->{$_} } keys %$active;
         die "E: $repo->{git_dir} $n shards failed" if $n;
         $repo_ctx->{shard_ok} = {}; # reset for future shard_done
         $n = $repo->{shard_n};
-        $active->{$n} = undef;
+        $repo_ctx->{active}->{$n} = undef; # may vivify $repo_ctx->{active}
         my ($c, $p) = PublicInbox::PktOp->pair;
         $c->{ops}->{repo_stored} = [ $self, $repo_ctx, $drs ];
         $IDX_SHARDS[$n]->wq_io_do('store_repo', [ $p->{op_p} ], $repo);