[Search] Infinite cycle check

in indexItems in the generic provider.
This commit is contained in:
slhale 2015-08-06 10:24:05 -07:00
parent f76f6548a5
commit a2eabc1b08

View File

@ -48,6 +48,7 @@ define(
*/
function GenericSearchProvider($q, objectService, workerService, ROOTS) {
var worker = workerService.run('genericSearchWorker'),
indexed = {},
pendingQueries = {};
// pendingQueries is a dictionary with the key value pairs st
// the key is the timestamp and the value is the promise
@ -123,8 +124,12 @@ define(
// Helper function for getItems(). Indexes the tree.
function indexItems(nodes) {
nodes.forEach(function (node) {
var id = node.getId();
if (!indexed[id]) {
// Index each item with the web worker
indexItem(node);
indexed[id] = true;
if (node.hasCapability('composition')) {
// This node has children
@ -137,6 +142,7 @@ define(
}
});
}
}
});
}