LP1821094: Add an AngularJS module that runs promises in batches user/sandbergja/lp1821094_item_status_reload_performance
authorJane Sandberg <sandbej@linnbenton.edu>
Thu, 30 Jan 2020 19:40:13 +0000 (11:40 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Thu, 30 Jan 2020 20:40:24 +0000 (12:40 -0800)
commit75176bca0ce8051a6dd4ba56f5613bce75901f09
treea5f080267153f88e0d4d0d7bf6dd7024e41ad647
parent249d9b28c3c87c8523c45d7e082d967e1224ca6a
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

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
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]