]> git.evergreen-ils.org Git - working/Evergreen.git/commit
LP1821094: Add an AngularJS module that runs promises in batches
authorJane Sandberg <sandbej@linnbenton.edu>
Thu, 30 Jan 2020 19:40:13 +0000 (11:40 -0800)
committerTerran McCanna <tmccanna@georgialibraries.org>
Mon, 1 Apr 2024 19:11:08 +0000 (15:11 -0400)
commitb4c8c29a24556d81dade49d797cfb2bbdbb1db90
tree21e3919fe93fe32666ff8a63acb4de3d45ce1774
parentc1ea5dcb50ce27070958962822f8df3e5adc5c9f
LP1821094: Add an AngularJS module that runs promises in batches

This service helps to reduce server load for repetitive OpenSRF
calls by dividing a large array of promises into batches. It
maintains the original order of the array when returning results.

Within each batch, calls are sent simultaneously. The batches
themselves are run sequentially.

This represents a middle ground between running a ton of OpenSRF
calls sequentially -- which leads to a long wait for the user --
and running them simultaneously, which can result in some serious
wait times.

One use case is when you need to get several rows from pcrud,
but the order of results is important and can't be just passed
using orderBy.

To use, you can just replace $q.all with egBatchPromises.all

This also changes the item status refresh code to use
egBatchPromises.all instead of $q.all, in response to some
pcrud-monopolizing noted in
https://bugs.launchpad.net/evergreen/+bug/1821094/comments/14

Release-note: Improves performance of item refresh after batch editing

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Jennifer Weston <jennifer.weston@equinoxoli.org>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates/staff/cat/item/index.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/services/batch_promises.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/test/karma.conf.js
Open-ILS/web/js/ui/default/staff/test/unit/egBatchPromises.js [new file with mode: 0644]