dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 2/3] searchidx: persist the PublicInbox::Git object
Date: Mon,  8 Aug 2016 21:27:50 +0000	[thread overview]
Message-ID: <20160808212751.27747-2-e@80x24.org> (raw)
In-Reply-To: <20160808212751.27747-1-e@80x24.org>

We can cheaply keep the object around nowadays since it
spawns expensive processes only on an as-needed basis.
---
 lib/PublicInbox/SearchIdx.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 9a462c7..2c4e704 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -44,6 +44,7 @@ sub new {
 	my $umask = _umask_for($perm);
 	$self->{umask} = $umask;
 	$self->{lock_path} = "$git_dir/ssoma.lock";
+	$self->{git} = PublicInbox::Git->new($git_dir);
 	$self->{xdb} = $self->with_umask(sub {
 		if ($writable == 1) {
 			require File::Path;
@@ -349,7 +350,7 @@ sub rlog {
 	my $h40 = $hex .'{40}';
 	my $addmsg = qr!^:000000 100644 \S+ ($h40) A\t${hex}{2}/${hex}{38}$!;
 	my $delmsg = qr!^:100644 000000 ($h40) \S+ D\t${hex}{2}/${hex}{38}$!;
-	my $git = PublicInbox::Git->new($self->{git_dir});
+	my $git = $self->{git};
 	my $log = $git->popen(qw/log --reverse --no-notes --no-color
 				--raw -r --no-abbrev/, $range);
 	my $latest;
-- 
EW


  reply	other threads:[~2016-08-08 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 21:27 [PATCH 1/3] searchidx: remove unused $git parameters Eric Wong
2016-08-08 21:27 ` Eric Wong [this message]
2016-08-08 21:27 ` [PATCH 3/3] searchidx: release Xapian FDs before spawning git log Eric Wong
  -- strict thread matches above, loose matches on Subject: below --
2016-08-07  3:18 [PATCH 1/3] searchidx: remove unused $git parameters Eric Wong
2016-08-07  3:18 ` [PATCH 2/3] searchidx: persist the PublicInbox::Git object 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

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

  git send-email \
    --in-reply-to=20160808212751.27747-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.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).