unofficial mirror of meta@public-inbox.org
 help / color / mirror / 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 related	[flat|nested] 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|nested] 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 related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-22  8:00 UTC | newest]

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

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