From adc2866a7d6255d6332a5b0b3488bbb841654478 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 22 May 2015 11:15:47 +0100 Subject: [PATCH] add check to exclude temporary ops from packs --- services/track-changes/app/coffee/PackManager.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/track-changes/app/coffee/PackManager.coffee b/services/track-changes/app/coffee/PackManager.coffee index 3ff39040c1..51ccecbc8e 100644 --- a/services/track-changes/app/coffee/PackManager.coffee +++ b/services/track-changes/app/coffee/PackManager.coffee @@ -263,10 +263,14 @@ module.exports = PackManager = docs = docs.slice(0,-KEEP_OPS) docs.forEach (d,i) -> + # skip existing packs if d.pack? - # util.log "skipping existing pack of #{d.pack.length}" - top = null if top? # flush the current pack - return # and try next + top = null + return + # skip temporary ops (we could pack these into temporary packs in future) + if d.expiresAt? + top = null + return sz = BSON.calculateObjectSize(d) if top? && top.pack.length < MAX_COUNT && top.sz + sz < MAX_SIZE top.pack = top.pack.concat {v: d.v, meta: d.meta, op: d.op, _id: d._id} @@ -308,6 +312,7 @@ module.exports = PackManager = prev = v v = p.v error('bad version', v, 'in', p) if v <= prev + #error('expired op', p, 'in pack') if p.expiresAt? else prev = v v = d.v