user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/3] some lei fixes
@ 2024-04-12 18:04 Eric Wong
  2024-04-12 18:04 ` [PATCH 1/3] lei_remote: solver supports uncommitted blobs Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2024-04-12 18:04 UTC (permalink / raw)
  To: meta

Some trivial fixes I noticed while (still) working on getting
lei to use checkpoint to improve parallelism.

Eric Wong (3):
  lei_remote: solver supports uncommitted blobs
  io: avoid redundant waitpid in DESTROY
  lei: remove leftover debugging message

 lib/PublicInbox/IO.pm        | 10 +++++-----
 lib/PublicInbox/LEI.pm       |  2 --
 lib/PublicInbox/LeiRemote.pm | 13 ++++++++++---
 3 files changed, 15 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] lei_remote: solver supports uncommitted blobs
  2024-04-12 18:04 [PATCH 0/3] some lei fixes Eric Wong
@ 2024-04-12 18:04 ` Eric Wong
  2024-04-12 18:04 ` [PATCH 2/3] io: avoid redundant waitpid in DESTROY Eric Wong
  2024-04-12 18:04 ` [PATCH 3/3] lei: remove leftover debugging message Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2024-04-12 18:04 UTC (permalink / raw)
  To: meta

This should improve `lei blob' and `lei rediff' functionality
for folks relying on `lei index' and allows future work to
improve parallelism via checkpointing in lei/store.
---
 lib/PublicInbox/LeiRemote.pm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/LeiRemote.pm b/lib/PublicInbox/LeiRemote.pm
index 559fb8d5..ddcaf2c9 100644
--- a/lib/PublicInbox/LeiRemote.pm
+++ b/lib/PublicInbox/LeiRemote.pm
@@ -67,9 +67,16 @@ sub base_url { "$_[0]->{uri}" }
 
 sub smsg_eml {
 	my ($self, $smsg) = @_;
-	if (my $bref = $self->{lei}->ale->git->cat_file($smsg->{blob})) {
-		return PublicInbox::Eml->new($bref);
-	}
+	my $bref = $self->{lei}->ale->git->cat_file($smsg->{blob}) // do {
+		my $lms = $self->{lei}->lms;
+		($lms ? $lms->local_blob($smsg->{blob}, 1) : undef) // do {
+			my $sto = $self->{lei}->{sto} //
+					$self->{lei}->_lei_store;
+			$sto && $sto->{-wq_s1} ?
+				$sto->wq_do('cat_blob', $smsg->{blob}) : undef;
+		}
+	};
+	return PublicInbox::Eml->new($bref) if $bref;
 	warn("E: $self->{uri} $smsg->{blob} gone <$smsg->{mid}>\n");
 	undef;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] io: avoid redundant waitpid in DESTROY
  2024-04-12 18:04 [PATCH 0/3] some lei fixes Eric Wong
  2024-04-12 18:04 ` [PATCH 1/3] lei_remote: solver supports uncommitted blobs Eric Wong
@ 2024-04-12 18:04 ` Eric Wong
  2024-04-12 18:04 ` [PATCH 3/3] lei: remove leftover debugging message Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2024-04-12 18:04 UTC (permalink / raw)
  To: meta

We shouldn't attempt to reap a process again after it's been
reaped asynchronously in the SIGCHLD handler.  Noticed while
working on changes to get lei/store to use checkpointing.
---
 lib/PublicInbox/IO.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/IO.pm b/lib/PublicInbox/IO.pm
index 02057600..8640f112 100644
--- a/lib/PublicInbox/IO.pm
+++ b/lib/PublicInbox/IO.pm
@@ -16,7 +16,7 @@ use PublicInbox::OnDestroy;
 
 sub waitcb { # awaitpid callback
 	my ($pid, $errref, $cb, @args) = @_;
-	$$errref = $? if $errref; # sets .cerr for _close
+	$$errref = $?; # sets .cerr for _close
 	$cb->($pid, @args) if $cb; # may clobber $?
 }
 
@@ -24,9 +24,9 @@ sub attach_pid {
 	my ($io, $pid, @cb_arg) = @_;
 	bless $io, __PACKAGE__;
 	# we share $err (and not $self) with awaitpid to avoid a ref cycle
-	${*$io}{pi_io_reap} = [ $PublicInbox::OnDestroy::fork_gen,
-				$pid, \(my $err) ];
-	awaitpid($pid, \&waitcb, \$err, @cb_arg);
+	my $e = \(my $err);
+	${*$io}{pi_io_reap} = [ $PublicInbox::OnDestroy::fork_gen, $pid, $e ];
+	awaitpid($pid, \&waitcb, $e, @cb_arg);
 	$io;
 }
 
@@ -60,7 +60,7 @@ sub DESTROY {
 	my $reap = delete ${*$io}{pi_io_reap};
 	if (($reap->[0] // -1) == $PublicInbox::OnDestroy::fork_gen) {
 		$io->SUPER::close;
-		awaitpid($reap->[1]);
+		${$reap->[2]} // awaitpid($reap->[1]);
 	}
 	$io->SUPER::DESTROY;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] lei: remove leftover debugging message
  2024-04-12 18:04 [PATCH 0/3] some lei fixes Eric Wong
  2024-04-12 18:04 ` [PATCH 1/3] lei_remote: solver supports uncommitted blobs Eric Wong
  2024-04-12 18:04 ` [PATCH 2/3] io: avoid redundant waitpid in DESTROY Eric Wong
@ 2024-04-12 18:04 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2024-04-12 18:04 UTC (permalink / raw)
  To: meta

Noticed while working on other things...

Fixes: 299aac294ec3 (lei: do label/keyword parsing in optparse, 2023-10-02)
---
 lib/PublicInbox/LEI.pm | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 06592358..5b46686a 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -728,8 +728,6 @@ sub optparse ($$$) {
 		require PublicInbox::LeiInput;
 		my @err = PublicInbox::LeiInput::vmd_mod_extract($self, $argv);
 		return $self->fail(join("\n", @err)) if @err;
-	} else {
-		warn "proto $proto\n" if $cmd =~ /(add-watch|tag|index)/;
 	}
 
 	my $i = 0;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-12 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 18:04 [PATCH 0/3] some lei fixes Eric Wong
2024-04-12 18:04 ` [PATCH 1/3] lei_remote: solver supports uncommitted blobs Eric Wong
2024-04-12 18:04 ` [PATCH 2/3] io: avoid redundant waitpid in DESTROY Eric Wong
2024-04-12 18:04 ` [PATCH 3/3] lei: remove leftover debugging message Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).