Commit 89f6bb0c authored by Romain Courteaud's avatar Romain Courteaud

Handle concurrent deletion while fetching all documents

parent 1e80b30f
......@@ -101,12 +101,22 @@
var include_query_list = [result],
len,
i;
function safeGet(j) {
return substorage.get({"_id": result[j].id})
.push(undefined, function (error) {
// Document may have been dropped after listing
if ((error instanceof jIO.util.jIOError) && (error.status_code === 404)) {
return;
}
throw error;
});
}
if (is_manual_include_needed) {
len = result.length;
for (i = 0; i < len; i += 1) {
include_query_list.push(
substorage.get({"_id": result[i].id})
);
include_query_list.push(safeGet(i));
}
result = RSVP.all(include_query_list);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment