user/dev discussion of public-inbox itself
 help / Atom feed
* [PATCH] search: lookup_mail handles modified DBs
@ 2016-12-22  7:55 Eric Wong
  2016-12-22  7:59 ` Eric Wong
  2016-12-22  8:00 ` [PATCH v2] " Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-22  7:55 UTC (permalink / raw)
  To: meta

We call lookup_mail all over the place, be sure we can handle
database modifications in those cases.
---
 lib/PublicInbox/Search.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 24cb266..82da262 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -295,8 +295,10 @@ sub lookup_message {
 
 sub lookup_mail { # no ghosts!
 	my ($self, $mid) = @_;
-	my $smsg = lookup_message($self, $mid) or return;
-	PublicInbox::SearchMsg->load_doc($smsg->{doc});
+	retry_reopen(sub {
+		my $smsg = lookup_message($self, $mid) or return;
+		PublicInbox::SearchMsg->load_doc($smsg->{doc});
+	});
 }
 
 sub find_unique_doc_id {
-- 
EW


^ permalink raw reply	[flat|threaded] 3+ messages in thread

* Re: [PATCH] search: lookup_mail handles modified DBs
  2016-12-22  7:55 [PATCH] search: lookup_mail handles modified DBs Eric Wong
@ 2016-12-22  7:59 ` Eric Wong
  2016-12-22  8:00 ` [PATCH v2] " Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-22  7:59 UTC (permalink / raw)
  To: meta

Eric Wong <e@80x24.org> wrote:
>  sub lookup_mail { # no ghosts!
>  	my ($self, $mid) = @_;
> -	my $smsg = lookup_message($self, $mid) or return;
> -	PublicInbox::SearchMsg->load_doc($smsg->{doc});
> +	retry_reopen(sub {

Erm...

--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -295,7 +295,7 @@ sub lookup_message {
 
 sub lookup_mail { # no ghosts!
 	my ($self, $mid) = @_;
-	retry_reopen(sub {
+	retry_reopen($self, sub {
 		my $smsg = lookup_message($self, $mid) or return;
 		PublicInbox::SearchMsg->load_doc($smsg->{doc});
 	});

^ permalink raw reply	[flat|threaded] 3+ messages in thread

* [PATCH v2] search: lookup_mail handles modified DBs
  2016-12-22  7:55 [PATCH] search: lookup_mail handles modified DBs Eric Wong
  2016-12-22  7:59 ` Eric Wong
@ 2016-12-22  8:00 ` " Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-22  8:00 UTC (permalink / raw)
  To: meta

We call lookup_mail all over the place, be sure we can handle
database modifications in those cases.
---
 lib/PublicInbox/Search.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 24cb266..fe461ac 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -295,8 +295,10 @@ sub lookup_message {
 
 sub lookup_mail { # no ghosts!
 	my ($self, $mid) = @_;
-	my $smsg = lookup_message($self, $mid) or return;
-	PublicInbox::SearchMsg->load_doc($smsg->{doc});
+	retry_reopen($self, sub {
+		my $smsg = lookup_message($self, $mid) or return;
+		PublicInbox::SearchMsg->load_doc($smsg->{doc});
+	});
 }
 
 sub find_unique_doc_id {
-- 
EW

^ permalink raw reply	[flat|threaded] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22  7:55 [PATCH] search: lookup_mail handles modified DBs Eric Wong
2016-12-22  7:59 ` Eric Wong
2016-12-22  8:00 ` [PATCH v2] " Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox