mirror of
https://github.com/nasa/openmct.git
synced 2025-05-13 14:03:21 +00:00
[Generic Search] Track pending indexes
Track domain objects which have indexing operations pending, to avoid redundantly indexing in cases where a broader indexed check is insufficient.
This commit is contained in:
parent
36d06e8b54
commit
134b749bbf
@ -52,6 +52,7 @@ define(
|
|||||||
*/
|
*/
|
||||||
function GenericSearchProvider($q, $log, throttle, objectService, workerService, topic, ROOTS) {
|
function GenericSearchProvider($q, $log, throttle, objectService, workerService, topic, ROOTS) {
|
||||||
var indexed = {},
|
var indexed = {},
|
||||||
|
pendingIndex = {},
|
||||||
pendingQueries = {},
|
pendingQueries = {},
|
||||||
toRequest = [],
|
toRequest = [],
|
||||||
worker = workerService.run('genericSearchWorker'),
|
worker = workerService.run('genericSearchWorker'),
|
||||||
@ -68,8 +69,9 @@ define(
|
|||||||
|
|
||||||
function scheduleIdsForIndexing(ids) {
|
function scheduleIdsForIndexing(ids) {
|
||||||
ids.forEach(function (id) {
|
ids.forEach(function (id) {
|
||||||
if (!indexed[id]) {
|
if (!indexed[id] && !pendingIndex[id]) {
|
||||||
indexed[id] = true;
|
indexed[id] = true;
|
||||||
|
pendingIndex[id] = true;
|
||||||
toRequest.push(id);
|
toRequest.push(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -129,6 +131,7 @@ define(
|
|||||||
function requestAndIndex(id) {
|
function requestAndIndex(id) {
|
||||||
pendingRequests += 1;
|
pendingRequests += 1;
|
||||||
objectService.getObjects([id]).then(function (objects) {
|
objectService.getObjects([id]).then(function (objects) {
|
||||||
|
delete pendingIndex[id];
|
||||||
if (objects[id]) {
|
if (objects[id]) {
|
||||||
indexItem(objects[id]);
|
indexItem(objects[id]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user