From: berick Date: Thu, 14 Apr 2011 19:04:23 +0000 (-0400) Subject: fetch bookbags inside xact to avoid replication delays, which can occur directly... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=dd5e7dfa1ae95ce0c65ad0413bef9829839cc3ea;p=evergreen%2Fequinox.git fetch bookbags inside xact to avoid replication delays, which can occur directly after bookbag-update actions --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index b7de272ca2..7b3384c8d3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -758,21 +758,31 @@ sub load_myopac_bookbags { my $e = $self->editor; my $ctx = $self->ctx; + $e->xact_begin; # replication... + my $rv = $self->load_mylist; - return $rv if $rv ne Apache2::Const::OK; + unless($rv eq Apache2::Const::OK) { + $e->rollback; + return $rv; + } my $args = { order_by => {cbreb => 'name'}, limit => $self->cgi->param('limit') || 10, - offset => $self->cgi->param('limit') || 0 + offset => $self->cgi->param('offset') || 0 }; $ctx->{bookbags} = $e->search_container_biblio_record_entry_bucket([ {owner => $self->editor->requestor->id, btype => 'bookbag'}, # XXX what to do about the possibility of really large bookbags here? {"flesh" => 1, "flesh_fields" => {"cbreb" => ["items"]}, %$args} - ]) or return $e->die_event; + ]); + if(!$ctx->{bookbags}) { + $e->rollback; + return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; + } + # get unique record IDs my %rec_ids = (); foreach my $bbag (@{$ctx->{bookbags}}) { @@ -785,6 +795,7 @@ sub load_myopac_bookbags { $ctx->{bookbags_marc_xml} = $self->fetch_marc_xml_by_id([keys %rec_ids]); + $e->rollback; return Apache2::Const::OK; }