dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH 1/2] gcf2: eliminate unnecessary autodie::close import
@ 2024-05-30  7:52 Eric Wong
  2024-05-30  7:52 ` [PATCH 2/2] git: avoid synchronous wait Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2024-05-30  7:52 UTC (permalink / raw)
  To: spew

We no longer call close() and I noticed since I plan on
eliminating some needless ->close calls in PublicInbox::Git
---
 lib/PublicInbox/Gcf2.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm
index 78392990..acc2091c 100644
--- a/lib/PublicInbox/Gcf2.pm
+++ b/lib/PublicInbox/Gcf2.pm
@@ -11,7 +11,7 @@ use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
 use IO::Handle; # autoflush
 use PublicInbox::Git qw($ck_unlinked_packs);
 use PublicInbox::Lock;
-use autodie qw(close open seek truncate);
+use autodie qw(open seek truncate);
 
 BEGIN {
 	my (%CFG, $c_src);

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

* [PATCH 2/2] git: avoid synchronous wait
  2024-05-30  7:52 [PATCH 1/2] gcf2: eliminate unnecessary autodie::close import Eric Wong
@ 2024-05-30  7:52 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2024-05-30  7:52 UTC (permalink / raw)
  To: spew

---
 lib/PublicInbox/Git.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index ff38efa1..55005475 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -208,7 +208,7 @@ sub cat_async_retry ($$) {
 		$oid = \$oid if !@$new_inflight; # to indicate oid retried
 		push @$new_inflight, $oid, $cb, $arg;
 	}
-	$sock->close if $sock; # only safe once old_inflight is empty
+	undef $sock; # gcf_drain may run from PublicInbox::IO::DESTROY
 	cat_async_step($self, $new_inflight); # take one step
 }
 
@@ -665,10 +665,9 @@ sub watch_async ($) {
 
 sub close {
 	my ($self) = @_;
-	my $sock = $self->{sock};
 	delete @$self{qw(-bc err_c inflight)};
 	delete($self->{epwatch}) ? $self->SUPER::close : delete($self->{sock});
-	$sock->close if $sock; # calls gcf_drain via awaitpid
+	# gcf_drain may run from PublicInbox::IO::DESTROY
 }
 
 package PublicInbox::GitCheck; # only for git <2.36

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

end of thread, other threads:[~2024-05-30  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-30  7:52 [PATCH 1/2] gcf2: eliminate unnecessary autodie::close import Eric Wong
2024-05-30  7:52 ` [PATCH 2/2] git: avoid synchronous wait Eric Wong

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