Bugzilla – Attachment 32102 Details for
Bug 12005
Zebra searches sometimes fail silently under Plack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12005 : Creating a new zebra connection for each time we need one
Bug-12005--Creating-a-new-zebra-connection-for-eac.patch (text/plain), 2.47 KB, created by
Chris Cormack
on 2014-10-09 16:06:01 UTC
(
hide
)
Description:
Bug 12005 : Creating a new zebra connection for each time we need one
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-10-09 16:06:01 UTC
Size:
2.47 KB
patch
obsolete
>From dffa96c7879475f727539314108e78a5e59654eb Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chris@bigballofwax.co.nz> >Date: Fri, 10 Oct 2014 05:03:01 +1300 >Subject: [PATCH] Bug 12005 : Creating a new zebra connection for each time we > need one > >Zebra is not designed to have persistent connections, under cgi this >didn't matter the scripts would get a new connection each time, but >under plack we try to use dead connections > >This patch changes it so plack works the same way that cgi did. > >To test: >Apply this patch >Do some searches >Check everything still works >--- > C4/Context.pm | 25 +++---------------------- > 1 file changed, 3 insertions(+), 22 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 63e8ebe..c87e7e2 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -672,9 +672,7 @@ sub AUTOLOAD > > $Zconn = C4::Context->Zconn > >-Returns a connection to the Zebra database for the current >-context. If no connection has yet been made, this method >-creates one and connects. >+Returns a connection to the Zebra database > > C<$self> > >@@ -689,25 +687,8 @@ C<$auth> whether this connection has rw access (1) or just r access (0 or NULL) > > sub Zconn { > my ($self, $server, $async, $auth, $piggyback, $syntax) = @_; >- #TODO: We actually just ignore the auth and syntax parameter >- #It also looks like we are not passing auth, piggyback, syntax anywhere >- >- my $cache_key = join ('::', (map { $_ // '' } ($server, $async, $auth, $piggyback, $syntax))); >- if ( defined($context->{"Zconn"}->{$cache_key}) && (0 == $context->{"Zconn"}->{$cache_key}->errcode()) ) { >- return $context->{"Zconn"}->{$cache_key}; >- # No connection object or it died. Create one. >- }else { >- # release resources if we're closing a connection and making a new one >- # FIXME: this needs to be smarter -- an error due to a malformed query or >- # a missing index does not necessarily require us to close the connection >- # and make a new one, particularly for a batch job. However, at >- # first glance it does not look like there's a way to easily check >- # the basic health of a ZOOM::Connection >- $context->{"Zconn"}->{$cache_key}->destroy() if defined($context->{"Zconn"}->{$cache_key}); >- >- $context->{"Zconn"}->{$cache_key} = &_new_Zconn( $server, $async, $piggyback ); >- return $context->{"Zconn"}->{$cache_key}; >- } >+ my $connection = _new_Zconn( $server, $async, $piggyback ); >+ return $connection; > } > > =head2 _new_Zconn >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12005
:
32102
|
32194
|
32218
|
32221
|
32334
|
32404
|
32417
|
32429