summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--worker.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/worker.js b/worker.js
index eb41240..b65bb59 100644
--- a/worker.js
+++ b/worker.js
@@ -86,7 +86,9 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI,
}
// helper: true if object is not in record arr
- let is_in = (arr, obj) => arr.map((o) => o.api_id).indexOf(obj.api_id) > -1;
+ // also, sort out invalid objects (undefined or null)
+ let is_in = (arr, obj) => obj == undefined ||
+ arr.map((o) => o.api_id).indexOf(obj.api_id) > -1;
// we aggregate record objects to do a bulk insert