From: Mike Taylor Date: Wed, 18 Oct 2006 14:03:42 +0000 (+0000) Subject: Attempt, once only, to re-open a closed zconn. X-Git-Tag: CPAN-v1.02~949 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=3bf8463da1c3cfc7f9706dcd372c21d7f9b280c2;p=irspy-moved-to-github.git Attempt, once only, to re-open a closed zconn. --- diff --git a/web/htdocs/details/found.mc b/web/htdocs/details/found.mc index 84f8514..c306375 100644 --- a/web/htdocs/details/found.mc +++ b/web/htdocs/details/found.mc @@ -1,4 +1,4 @@ -%# $Id: found.mc,v 1.13 2006-10-18 12:36:05 mike Exp $ +%# $Id: found.mc,v 1.14 2006-10-18 14:03:42 mike Exp $ <%once> use XML::LibXML; use XML::LibXML::XPathContext; @@ -55,13 +55,24 @@ if ($sort) { $query .= " 0"; } +my $tried_to_open = 0; if (!defined $conn) { + OPEN: $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1"); + $conn->option(elementSetName => "zeerex"); } -$conn->option(elementSetName => "zeerex"); my $parser = new XML::LibXML(); -my $rs = $conn->search(new ZOOM::Query::CQL($query)); +my $rs; +eval { $rs = $conn->search(new ZOOM::Query::CQL($query)) }; +if ($@ && ref $@ && $@->isa('ZOOM::Exception') && + $@->code() == ZOOM::Error::CONNECTION_LOST && !$tried_to_open) { + $tried_to_open = 1; + goto OPEN; +} elsif ($@) { + die $@; +} + my $n = $rs->size(); my $skip = $params{"_skip"} || 0;