From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9F63F1F934 for ; Fri, 8 Oct 2021 10:20:04 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] git: use async_wait_all everywhere Date: Fri, 8 Oct 2021 10:20:02 +0000 Message-Id: <20211008102004.7879-2-e@80x24.org> In-Reply-To: <20211008102004.7879-1-e@80x24.org> References: <20211008102004.7879-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Some code paths may use maximum size checks, so ensure any checks are waited on, too. --- lib/PublicInbox/LeiSearch.pm | 4 ++-- lib/PublicInbox/LeiStore.pm | 2 +- lib/PublicInbox/V2Writable.pm | 6 +++--- t/git.t | 4 ++-- xt/cmp-msgstr.t | 2 +- xt/cmp-msgview.t | 2 +- xt/eml_check_limits.t | 2 +- xt/eml_octet-stream.t | 2 +- xt/git_async_cmp.t | 2 +- xt/msgtime_cmp.t | 2 +- xt/perf-msgview.t | 2 +- xt/perf-obfuscate.t | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm index 568277a6f404..4e048e9a40b7 100644 --- a/lib/PublicInbox/LeiSearch.pm +++ b/lib/PublicInbox/LeiSearch.pm @@ -119,13 +119,13 @@ sub xoids_for { $git->cat_async($cur->{blob}, \&_cmp_1st, [$chash, $xoids, $cur, $lms]); if ($min && scalar(keys %$xoids) >= $min) { - $git->cat_async_wait; + $git->async_wait_all; return $xoids; } } } } - $git->cat_async_wait; + $git->async_wait_all; scalar(keys %$xoids) ? $xoids : undef; } diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index b4f40912aa61..52a1456fb415 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -305,7 +305,7 @@ sub remove_eml { $git->cat_async($oidhex, \&_remove_if_local, $self); } } - $git->cat_async_wait; + $git->async_wait_all; remove_docids($self, @docids); \@docids; } diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 36b84f5708ae..fcd7ffe2317b 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1031,7 +1031,7 @@ sub sync_prepare ($$) { my $req = { %$sync, oid => $oid }; $self->git->cat_async($oid, $unindex_oid, $req); } - $self->git->cat_async_wait; + $self->git->async_wait_all; } return 0 if $sync->{quit}; if (!$regen_max) { @@ -1113,7 +1113,7 @@ sub unindex_todo ($$$) { $self->git->cat_async($1, $unindex_oid, { %$sync, oid => $1 }); } close $fh or die "git log failed: \$?=$?"; - $self->git->cat_async_wait; + $self->git->async_wait_all; return unless $sync->{-opt}->{prune}; my $after = scalar keys %$unindexed; @@ -1245,7 +1245,7 @@ sub xapian_only { index_xap_step($self, $sync, $art_beg, 1); } } - $self->git->cat_async_wait; + $self->git->async_wait_all; $self->{ibx}->cleanup; $self->done; } diff --git a/t/git.t b/t/git.t index 844e0111f367..2a189eac6c40 100644 --- a/t/git.t +++ b/t/git.t @@ -61,7 +61,7 @@ use_ok 'PublicInbox::Git'; my ($bref, $oid_hex, $type, $size, $arg) = @_; $missing = [ @_ ]; }, $arg); - $gcf->cat_async_wait; + $gcf->async_wait_all; my ($bref, $oid_hex, $type, $size, $arg_res) = @$res; is_deeply([$oid_hex, $type, $size], \@x, 'got expected header'); is($arg_res, $arg, 'arg passed to cat_async'); @@ -147,7 +147,7 @@ SKIP: { # trigger cat_async_retry: $gcf->cat_async($remote, $cb, $results); } - $gcf->cat_async_wait; + $gcf->async_wait_all; my $expect = [ @exist[0..3], [ $remote, 'blob', 5 ], @exist[4..5] ]; is_deeply($results, $expect, 'got expected results'); diff --git a/xt/cmp-msgstr.t b/xt/cmp-msgstr.t index 900127c76cae..b6c8ec659ceb 100644 --- a/xt/cmp-msgstr.t +++ b/xt/cmp-msgstr.t @@ -100,7 +100,7 @@ my $t = timeit(1, sub { ++$n; $git->cat_async($oid, $git_cb); } - $git->cat_async_wait; + $git->async_wait_all; }); is($m, $n, "$inboxdir rendered all $m <=> $n messages"); is($ndiff, 0, "$inboxdir $ndiff differences"); diff --git a/xt/cmp-msgview.t b/xt/cmp-msgview.t index 49dcbc9ea3dd..9b06f88deade 100644 --- a/xt/cmp-msgview.t +++ b/xt/cmp-msgview.t @@ -84,7 +84,7 @@ my $t = timeit(1, sub { ++$n; $git->cat_async($oid, $git_cb); } - $git->cat_async_wait; + $git->async_wait_all; }); is($m, $n, 'rendered all messages'); diff --git a/xt/eml_check_limits.t b/xt/eml_check_limits.t index 536a25f159bd..a6d010af0518 100644 --- a/xt/eml_check_limits.t +++ b/xt/eml_check_limits.t @@ -67,7 +67,7 @@ my $t = timeit(1, sub { ++$n; $git->cat_async($blob, $cat_cb); } - $git->cat_async_wait; + $git->async_wait_all; }); is($m, $n, 'scanned all messages'); diag "$$ $inboxdir took ".timestr($t)." for $n <=> $m messages"; diff --git a/xt/eml_octet-stream.t b/xt/eml_octet-stream.t index 8173aec2fd5e..3914f08970dc 100644 --- a/xt/eml_octet-stream.t +++ b/xt/eml_octet-stream.t @@ -69,7 +69,7 @@ while (<$cat>) { my ($oid, $type, $size) = split(/ /); $git->cat_async($oid, $cb) if $size && $type eq 'blob'; } -$git->cat_async_wait; +$git->async_wait_all; note "$errs errors"; note "$ok/$tot messages had text as application/octet-stream"; ok 1; diff --git a/xt/git_async_cmp.t b/xt/git_async_cmp.t index a7a94c2debc3..d66b371ff760 100644 --- a/xt/git_async_cmp.t +++ b/xt/git_async_cmp.t @@ -32,7 +32,7 @@ my $async = timeit($nr, sub { $git->cat_async($oid, $cb); } close $cat or die "cat: $?"; - $git->cat_async_wait; + $git->async_wait_all; push @dig, ['async', $dig->hexdigest ]; }); diff --git a/xt/msgtime_cmp.t b/xt/msgtime_cmp.t index ae9e42152a1a..a7ef5245bd8d 100644 --- a/xt/msgtime_cmp.t +++ b/xt/msgtime_cmp.t @@ -64,7 +64,7 @@ while (<$fh>) { next if $type ne 'blob'; $git->cat_async($oid, \&compare); } -$git->cat_async_wait; +$git->async_wait_all; ok(1); done_testing; diff --git a/xt/perf-msgview.t b/xt/perf-msgview.t index f97c06fb2e65..bc73fccea9a1 100644 --- a/xt/perf-msgview.t +++ b/xt/perf-msgview.t @@ -66,7 +66,7 @@ my $t = timeit(1, sub { $git->cat_async($oid, $cb); } } - $git->cat_async_wait; + $git->async_wait_all; }); diag 'multipart_text_as_html took '.timestr($t)." for $n <=> $m messages"; is($m, $n, 'rendered all messages'); diff --git a/xt/perf-obfuscate.t b/xt/perf-obfuscate.t index d4e7fb9929ec..640309d2cbc6 100644 --- a/xt/perf-obfuscate.t +++ b/xt/perf-obfuscate.t @@ -57,7 +57,7 @@ my $t = timeit(1, sub { ++$n; $git->cat_async($oid, $cb); } - $git->cat_async_wait; + $git->async_wait_all; }); diag 'multipart_text_as_html took '.timestr($t)." for $n <=> $m messages"; is($m, $n, 'rendered all messages');