LP1896285 Batch mark item missing serialized
authorBill Erickson <berickxx@gmail.com>
Wed, 2 Dec 2020 22:02:24 +0000 (14:02 -0800)
committerBill Erickson <berickxx@gmail.com>
Mon, 11 Jan 2021 20:43:41 +0000 (15:43 -0500)
Process batches of items one at a time when marking them lost to avoid
sending too many parallel requests to the server.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index 54aa9f3..6f22aa8 100644 (file)
@@ -1521,11 +1521,13 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,  egAddCopyAl
         ).result.then(function() {
             return egCore.pcrud.retrieve('ccs', 4)
                 .then(function(resp) {
         ).result.then(function() {
             return egCore.pcrud.retrieve('ccs', 4)
                 .then(function(resp) {
-                    var promises = [];
+                    var promise = $q.when();
                     angular.forEach(copies, function(copy) {
                     angular.forEach(copies, function(copy) {
-                        promises.push(service.mark_item(copy, resp, {}))
+                        promise = promise.then(function() {
+                            return service.mark_item(copy, resp, {});
+                        });
                     });
                     });
-                    return $q.all(promises);
+                    return promise;
                 });
         });
     }
                 });
         });
     }