@@ -, +, @@ need one --- C4/Context.pm | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) --- a/C4/Context.pm +++ a/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 --