Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/inflate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ const { DeltaOp, DeltaCohort, OP_COHORT } = require('./compression.js')

exports.inflate = async function inflate(ptr, config) {
if (ptr.value) return ptr.value
if (ptr.inflating) return ptr.inflating

ptr.inflating = _inflate(ptr, config)

try {
return await ptr.inflating
} finally {
ptr.inflating = null
}
}

async function _inflate(ptr, config) {
const [block, context] = await Promise.all([
ptr.context.getBlock(ptr.seq, ptr.core, config),
ptr.context.getContext(ptr.core, config)
Expand Down
2 changes: 2 additions & 0 deletions lib/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class TreeNodePointer extends Pointer {

this.next = null
this.prev = null

this.inflating = null
}

commit() {
Expand Down
Loading