mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 06:51:39 +00:00
add check to exclude temporary ops from packs
This commit is contained in:
parent
ffeb1cccb6
commit
adc2866a7d
1 changed files with 8 additions and 3 deletions
|
@ -263,10 +263,14 @@ module.exports = PackManager =
|
||||||
docs = docs.slice(0,-KEEP_OPS)
|
docs = docs.slice(0,-KEEP_OPS)
|
||||||
|
|
||||||
docs.forEach (d,i) ->
|
docs.forEach (d,i) ->
|
||||||
|
# skip existing packs
|
||||||
if d.pack?
|
if d.pack?
|
||||||
# util.log "skipping existing pack of #{d.pack.length}"
|
top = null
|
||||||
top = null if top? # flush the current pack
|
return
|
||||||
return # and try next
|
# skip temporary ops (we could pack these into temporary packs in future)
|
||||||
|
if d.expiresAt?
|
||||||
|
top = null
|
||||||
|
return
|
||||||
sz = BSON.calculateObjectSize(d)
|
sz = BSON.calculateObjectSize(d)
|
||||||
if top? && top.pack.length < MAX_COUNT && top.sz + sz < MAX_SIZE
|
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}
|
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
|
prev = v
|
||||||
v = p.v
|
v = p.v
|
||||||
error('bad version', v, 'in', p) if v <= prev
|
error('bad version', v, 'in', p) if v <= prev
|
||||||
|
#error('expired op', p, 'in pack') if p.expiresAt?
|
||||||
else
|
else
|
||||||
prev = v
|
prev = v
|
||||||
v = d.v
|
v = d.v
|
||||||
|
|
Loading…
Reference in a new issue