[open-ils-commits] [GIT] Evergreen ILS branch rel_2_12 updated. 77211d14580ddc09f3bd14c9756c20539c53528a

Evergreen Git git at git.evergreen-ils.org
Fri Jul 21 12:33:19 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_12 has been updated
       via  77211d14580ddc09f3bd14c9756c20539c53528a (commit)
      from  d42b64946a3187709e0c11d1b35288170eb6a8e7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 77211d14580ddc09f3bd14c9756c20539c53528a
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Thu Jul 20 16:17:12 2017 -0400

    LP#1705731: background batch MARC edits now report status less verbosely
    
    Rather than repeatedly inserting and fetching potentially
    very large arrays of per-record status statements from the
    anon cache, batch MARC edits that are run in the background
    now report counts.
    
    This patch changes how open-ils.cat.container.template_overlay.background
    populates the anonymous cache; note that streaming status updates
    if calling open-ils.cat.container.template_overlay instead are
    *not* changed.
    
    To test
    -------
    [1] Set up a MARC Batch Edit run using a reasonably large bucket
        as a source records.
    [2] Verify that progress is reported correctly during the run.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index 0800b88..e083c3b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -263,11 +263,11 @@ sub template_overlay_container {
         $template = $e->retrieve_biblio_record_entry( $titem->target_biblio_record_entry )->marc;
     }
 
-    my $responses = [];
-    my $some_failed = 0;
+    my $num_failed = 0;
+    my $num_succeeded = 0;
 
     $conn->respond_complete(
-        $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses)->gather(1)
+        $actor->request('open-ils.actor.anon_cache.set_value', $auth, batch_edit_progress => {})->gather(1)
     ) if ($actor);
 
     for my $item ( @$items ) {
@@ -281,11 +281,20 @@ sub template_overlay_container {
             )->[0]->{'vandelay.template_overlay_bib_record'};
         }
 
-        $some_failed++ if ($success eq 'f');
+        if ($success eq 'f') {
+            $num_failed++;
+        } else {
+            $num_succeeded++;
+        }
 
         if ($actor) {
-            push @$responses, { record => $rec->id, success => $success };
-            $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+            $actor->request(
+                'open-ils.actor.anon_cache.set_value', $auth,
+                batch_edit_progress => {
+                    succeeded => $num_succeeded,
+                    failed    => $num_failed
+                },
+            );
         } else {
             $conn->respond({ record => $rec->id, success => $success });
         }
@@ -294,8 +303,15 @@ sub template_overlay_container {
             unless ($e->delete_container_biblio_record_entry_bucket_item($item)) {
                 $e->rollback;
                 if ($actor) {
-                    push @$responses, { complete => 1, success => 'f' };
-                    $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+                    $actor->request(
+                        'open-ils.actor.anon_cache.set_value', $auth,
+                        batch_edit_progress => {
+                            complete => 1,
+                            success  => 'f',
+                            succeeded => $num_succeeded,
+                            failed    => $num_failed,
+                        }
+                    );
                     return undef;
                 } else {
                     return { complete => 1, success => 'f' };
@@ -304,21 +320,35 @@ sub template_overlay_container {
         }
     }
 
-    if ($titem && !$some_failed) {
+    if ($titem && !$num_failed) {
         return $e->die_event unless ($e->delete_container_biblio_record_entry_bucket_item($titem));
     }
 
     if ($e->commit) {
         if ($actor) {
-            push @$responses, { complete => 1, success => 't' };
-            $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+            $actor->request(
+                'open-ils.actor.anon_cache.set_value', $auth,
+                batch_edit_progress => {
+                    complete => 1,
+                    success  => 't',
+                    succeeded => $num_succeeded,
+                    failed    => $num_failed,
+                }
+            );
         } else {
             return { complete => 1, success => 't' };
         }
     } else {
         if ($actor) {
-            push @$responses, { complete => 1, success => 'f' };
-            $actor->request('open-ils.actor.anon_cache.set_value', $auth, res_list => $responses);
+            $actor->request(
+                'open-ils.actor.anon_cache.set_value', $auth,
+                batch_edit_progress => {
+                    complete => 1,
+                    success  => 'f',
+                    succeeded => $num_succeeded,
+                    failed    => $num_failed,
+                }
+            );
         } else {
             return { complete => 1, success => 'f' };
         }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm
index 6d75965..fa4fc5d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm
@@ -257,28 +257,21 @@ sub show_processing_template {
                     fieldmapper.standardRequest(
                         ['open-ils.actor','open-ils.actor.anon_cache.get_value'],
                         { async : false,
-                          params: [ u.authtoken, 'res_list' ],
+                          params: [ u.authtoken, 'batch_edit_progress' ],
                           onerror : function (r) { progress_dialog.hide(); },
                           onresponse : function (r) {
                             var counter = { success : 0, fail : 0, total : 0 };
-                            dojo.forEach( openils.Util.readResponse(r), function(x) {
+                            if (x = openils.Util.readResponse(r)) {
+                                counter.success = x.succeeded;
+                                counter.fail    = x.failed;
+                                counter.total = counter.success + counter.fail;
                                 if (x.complete) {
                                     clearInterval(interval);
                                     progress_dialog.hide();
                                     if (x.success == 't') dojo.byId('complete_msg').innerHTML = 'Overlay completed successfully';
                                     else dojo.byId('complete_msg').innerHTML = 'Overlay did not complet successfully';
-                                } else {
-                                    counter.total++;
-                                    switch (x.success) {
-                                        case 't':
-                                            counter.success++;
-                                            break;
-                                        default:
-                                            counter.fail++;
-                                            break;
-                                    }
                                 }
-                            });
+                            };
 
                             // update the progress dialog
                             progress_dialog.update({progress:counter.total});

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Cat.pm    |   56 +++++++++++++++-----
 .../lib/OpenILS/WWW/TemplateBatchBibUpdate.pm      |   19 ++-----
 2 files changed, 49 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list