sort by doc_id to ensure consistent order for all changes with the same timestamp

This commit is contained in:
Brian Gough 2015-02-16 16:44:06 +00:00
parent 7d6811559c
commit 92e67511d5

View file

@ -158,7 +158,12 @@ module.exports = MongoPackManager =
return true
timeOrder = (a, b) ->
b.meta.end_ts - a.meta.end_ts
(b.meta.end_ts - a.meta.end_ts) || documentOrder(a, b)
documentOrder = (a, b) ->
x = a.doc_id.valueOf()
y = b.doc_id.valueOf()
if x > y then 1 else if x < y then -1 else 0
updates = MongoPackManager._filterAndLimit(updates, unpackedSet, filterFn, limit)
#console.log 'initial updates are', updates