[open-ils-commits] r12563 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 17 12:52:45 EDT 2009
Author: erickson
Date: 2009-03-17 12:52:43 -0400 (Tue, 17 Mar 2009)
New Revision: 12563
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
when searching bibs, don't start the cstore xact until after the results have returned to prevent connection timeout (and useless pinning of backend)
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2009-03-17 15:45:06 UTC (rev 12562)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2009-03-17 16:52:43 UTC (rev 12563)
@@ -414,42 +414,26 @@
sub zsearch {
my($self, $conn, $auth, $search, $name, $options) = @_;
- my $e = new_editor(authtoken=>$auth, xact=>1);
- return $e->die_event unless $e->checkauth;
- return $e->die_event unless $e->allowed('CREATE_PICKLIST');
+ my $e = new_editor(authtoken=>$auth);
+ return $e->event unless $e->checkauth;
+ return $e->event unless $e->allowed('CREATE_PICKLIST');
$search->{limit} ||= 10;
$options ||= {};
- $name ||= '';
- my $picklist = $e->search_acq_picklist({owner=>$e->requestor->id, name=>$name})->[0];
- if($name eq '' and $picklist) {
- my $evt = delete_picklist($self, $conn, $auth, $picklist->id);
- return $evt unless $evt == 1;
- $picklist = undef;
- }
-
- unless($picklist) {
- $picklist = Fieldmapper::acq::picklist->new;
- $picklist->owner($e->requestor->id);
- $picklist->creator($e->requestor->id);
- $picklist->editor($e->requestor->id);
- $picklist->edit_time('now');
- $picklist->name($name);
- $picklist->org_unit($e->requestor->ws_ou);
- $e->create_acq_picklist($picklist) or return $e->die_event;
-
- } else {
- $picklist->editor($e->requestor->id);
- $picklist->edit_time('now');
- $e->update_acq_picklist($picklist) or return $e->die_event;
- }
-
my $ses = OpenSRF::AppSession->create('open-ils.search');
my $req = $ses->request('open-ils.search.z3950.search_class', $auth, $search);
+ my $first = 1;
+ my $picklist;
while(my $resp = $req->recv(timeout=>60)) {
+ if($first) {
+ $e = new_editor(requestor=>$e->requestor, xact=>1);
+ $picklist = zsearch_build_pl($self, $conn, $auth, $e, $name);
+ $first = 0;
+ }
+
my $result = $resp->content;
my $count = $result->{count};
my $total = (($count < $search->{limit}) ? $count : $search->{limit})+1;
@@ -487,6 +471,37 @@
return {complete=>1, picklist_id=>$picklist->id};
}
+sub zsearch_build_pl {
+ my($self, $conn, $auth, $e, $name) = @_;
+ $name ||= '';
+ my $picklist = $e->search_acq_picklist({owner=>$e->requestor->id, name=>$name})->[0];
+ if($name eq '' and $picklist) {
+ my $evt = delete_picklist($self, $conn, $auth, $picklist->id);
+ return $evt unless $evt == 1;
+ $picklist = undef;
+ }
+ unless($picklist) {
+ $picklist = Fieldmapper::acq::picklist->new;
+ $picklist->owner($e->requestor->id);
+ $picklist->creator($e->requestor->id);
+ $picklist->editor($e->requestor->id);
+ $picklist->edit_time('now');
+ $picklist->name($name);
+ $picklist->org_unit($e->requestor->ws_ou);
+ $e->create_acq_picklist($picklist) or return $e->die_event;
+
+ } else {
+ $picklist->editor($e->requestor->id);
+ $picklist->edit_time('now');
+ $e->update_acq_picklist($picklist) or return $e->die_event;
+ }
+
+ return $picklist;
+}
+
+
+
+
1;
More information about the open-ils-commits
mailing list