user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] searchidx: persist the PublicInbox::Git object
Date: Tue,  9 Aug 2016 00:22:51 +0000	[thread overview]
Message-ID: <20160809002252.31177-3-e@80x24.org> (raw)
In-Reply-To: <20160809002252.31177-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


  parent reply	other threads:[~2016-08-09  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09  0:22 [PATCH 0/3] searchidx: workaround lack of close-on-exec Eric Wong
2016-08-09  0:22 ` [PATCH 1/3] searchidx: remove unused $git parameters Eric Wong
2016-08-09  0:22 ` Eric Wong [this message]
2016-08-09  0:22 ` [PATCH 3/3] searchidx: release Xapian FDs before spawning git log Eric Wong
2016-08-09  0:48 ` [PATCH 4/3] searchidx: avoid holding Xapian lock in cat-file 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: http://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=20160809002252.31177-3-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.
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).