[open-ils-commits] r18136 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Circ web/opac/extras/circ (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Oct 2 11:47:31 EDT 2010
Author: miker
Date: 2010-10-02 11:47:28 -0400 (Sat, 02 Oct 2010)
New Revision: 18136
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
trunk/Open-ILS/web/opac/extras/circ/alt_pull_list.html
Log:
configurable chunking of the holds stream to avoid the xulrunner "I forgot the chunked stream" problem
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-10-02 13:49:55 UTC (rev 18135)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-10-02 15:47:28 UTC (rev 18136)
@@ -1341,6 +1341,9 @@
delete($$params{org_id}) unless (int($$params{org_id}));
delete($$params{limit}) unless (int($$params{limit}));
delete($$params{offset}) unless (int($$params{offset}));
+ delete($$params{chunk_size}) unless (int($$params{chunk_size}));
+ delete($$params{chunk_size}) if ($$params{chunk_size} && $$params{chunk_size} > 50); # keep the size reasonable
+ $$params{chunk_size} ||= 10;
$$params{org_id} = (defined $$params{org_id}) ? $$params{org_id}: $e->requestor->ws_ou;
return $e->die_event unless $e->allowed('VIEW_HOLD', $$params{org_id });
@@ -1409,21 +1412,28 @@
$logger->info("about to stream back " . scalar(@$holds_ids) . " holds");
- $client->respond(
- $e->retrieve_action_hold_request([
+ my @chunk;
+ for my $hid (@$holds_ids) {
+ push @chunk, $e->retrieve_action_hold_request([
$_->{"id"}, {
"flesh" => 3,
"flesh_fields" => {
"ahr" => ["usr", "current_copy"],
+ "au" => ["card"],
"acp" => ["location", "call_number"],
"acn" => ["record"]
}
}
- ])
- ) foreach @$holds_ids;
+ ]);
+ if (@chunk >= $$params{chunk_size}) {
+ $client->respond( \@chunk );
+ @chunk = ();
+ }
+ }
+ $client->respond_complete( \@chunk ) if (@chunk);
$e->disconnect;
- undef;
+ return undef;
}
Modified: trunk/Open-ILS/web/opac/extras/circ/alt_pull_list.html
===================================================================
--- trunk/Open-ILS/web/opac/extras/circ/alt_pull_list.html 2010-10-02 13:49:55 UTC (rev 18135)
+++ trunk/Open-ILS/web/opac/extras/circ/alt_pull_list.html 2010-10-02 15:47:28 UTC (rev 18136)
@@ -61,42 +61,44 @@
{ async : true,
params: [
user.authtoken,
- { org_id : cgi.param('o'),
- limit : cgi.param('limit'),
- offset : cgi.param('offset'),
- sort : sort_order
+ { org_id : cgi.param('o'),
+ limit : cgi.param('limit'),
+ offset : cgi.param('offset'),
+ chunk_size : cgi.param('chunk_size'),
+ sort : sort_order
}
],
onresponse : function (r) {
- var hold_fm = openils.Util.readResponse(r);
-
- // hashify the hold
- var hold = hold_fm.toHash(true);
- hold.current_copy = hold_fm.current_copy().toHash(true);
- hold.current_copy.location = hold_fm.current_copy().location().toHash(true);
- hold.current_copy.call_number = hold_fm.current_copy().call_number().toHash(true);
- hold.current_copy.call_number.record = hold_fm.current_copy().call_number().record().toHash(true);
-
- // clone the template's html
- var tr = dojo.clone(
- dojo.query("tr", dojo.byId('template'))[0]
- );
- dojo.query("td:not([type])", tr).forEach(
- function(td) {
- td.innerHTML =
- dojo.string.substitute(td.innerHTML, hold);
- }
- );
-
- new openils.BibTemplate({
- root : tr,
- xml : dojox.xml.parser.parse(hold.current_copy.call_number.record.marc),
- delay: false
+ dojo.forEach( openils.Util.readResponse(r), function (hold_fm) {
+
+ // hashify the hold
+ var hold = hold_fm.toHash(true);
+ hold.usr = hold_fm.usr().toHash(true);
+ hold.usr.card = hold_fm.usr().card().toHash(true);
+ hold.current_copy = hold_fm.current_copy().toHash(true);
+ hold.current_copy.location = hold_fm.current_copy().location().toHash(true);
+ hold.current_copy.call_number = hold_fm.current_copy().call_number().toHash(true);
+ hold.current_copy.call_number.record = hold_fm.current_copy().call_number().record().toHash(true);
+
+ // clone the template's html
+ var tr = dojo.clone(
+ dojo.query("tr", dojo.byId('template'))[0]
+ );
+ dojo.query("td:not([type])", tr).forEach(
+ function(td) {
+ td.innerHTML =
+ dojo.string.substitute(td.innerHTML, hold);
+ }
+ );
+
+ new openils.BibTemplate({
+ root : tr,
+ xml : dojox.xml.parser.parse(hold.current_copy.call_number.record.marc),
+ delay: false
+ });
+
+ dojo.place(tr, "target");
});
-
- dojo.place(tr, "target");
-
-
},
oncomplete : function () {
progress_dialog.hide(); window.print() }
More information about the open-ils-commits
mailing list