View | Details | Raw Unified | Return to bug 11701
Collapse All | Expand All

(-)a/C4/Context.pm (-13 / +9 lines)
Lines 687-700 C<$auth> whether this connection has rw access (1) or just r access (0 or NULL) Link Here
687
=cut
687
=cut
688
688
689
sub Zconn {
689
sub Zconn {
690
    my $self=shift;
690
    my ($self, $server, $async, $auth, $piggyback, $syntax) = @_;
691
    my $server=shift;
691
692
    my $async=shift;
692
    my $cache_key = join ('::', (map { $_ // '' } @_));
693
    my $auth=shift;
693
    if ( defined($context->{"Zconn"}->{$cache_key}) && (0 == $context->{"Zconn"}->{$cache_key}->errcode()) ) {
694
    my $piggyback=shift;
694
        return $context->{"Zconn"}->{$cache_key};
695
    my $syntax=shift;
696
    if ( defined($context->{"Zconn"}->{$server}->{$async}) && (0 == $context->{"Zconn"}->{$server}->{$async}->errcode()) ) {
697
        return $context->{"Zconn"}->{$server}->{$async};
698
    # No connection object or it died. Create one.
695
    # No connection object or it died. Create one.
699
    }else {
696
    }else {
700
        # release resources if we're closing a connection and making a new one
697
        # release resources if we're closing a connection and making a new one
Lines 703-714 sub Zconn { Link Here
703
        # and make a new one, particularly for a batch job.  However, at
700
        # and make a new one, particularly for a batch job.  However, at
704
        # first glance it does not look like there's a way to easily check
701
        # first glance it does not look like there's a way to easily check
705
        # the basic health of a ZOOM::Connection
702
        # the basic health of a ZOOM::Connection
706
        $context->{"Zconn"}->{$server}->{$async}->destroy() if defined($context->{"Zconn"}->{$server}->{$async});
703
        $context->{"Zconn"}->{$cache_key}->destroy() if defined($context->{"Zconn"}->{$cache_key});
707
704
708
        $context->{"Zconn"}->{$server}->{$async} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
705
        $context->{"Zconn"}->{$cache_key} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
709
        $context->{ Zconn }->{ $server }->{$async}->option(
706
        $context->{ Zconn }->{$cache_key}->option(
710
            preferredRecordSyntax => C4::Context->preference("marcflavour") );
707
            preferredRecordSyntax => C4::Context->preference("marcflavour") );
711
        return $context->{"Zconn"}->{$server}->{$async};
708
        return $context->{"Zconn"}->{$cache_key};
712
    }
709
    }
713
}
710
}
714
711
715
- 

Return to bug 11701