unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/3] git: use async_wait_all everywhere
Date: Fri,  8 Oct 2021 10:20:02 +0000	[thread overview]
Message-ID: <20211008102004.7879-2-e@80x24.org> (raw)
In-Reply-To: <20211008102004.7879-1-e@80x24.org>

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');

  reply	other threads:[~2021-10-08 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 10:20 [PATCH 0/3] git: propagate die from async callbacks Eric Wong
2021-10-08 10:20 ` Eric Wong [this message]
2021-10-08 10:20 ` [PATCH 2/3] git: async_abort includes --batch-check requests Eric Wong
2021-10-08 10:20 ` [PATCH 3/3] git: fatalize async callback errors by default Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211008102004.7879-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).