Allow simultaneous adds
This commit is contained in:
parent
1b6fea6e4d
commit
021844bf0a
2 changed files with 6 additions and 6 deletions
|
@ -300,9 +300,7 @@ export class BaseRoom extends EventEmitter {
|
||||||
await decryptRequest.complete();
|
await decryptRequest.complete();
|
||||||
}
|
}
|
||||||
// once txn is committed, update in-memory state & emit events
|
// once txn is committed, update in-memory state & emit events
|
||||||
for (const fragment of gapResult.fragments) {
|
this._fragmentIdComparer.add(...gapResult.fragments);
|
||||||
this._fragmentIdComparer.add(fragment);
|
|
||||||
}
|
|
||||||
if (extraGapFillChanges) {
|
if (extraGapFillChanges) {
|
||||||
this._applyGapFill(extraGapFillChanges);
|
this._applyGapFill(extraGapFillChanges);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,9 +171,11 @@ export class FragmentIdComparer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** use for fragments coming out of persistence, not newly created ones, or also fragments for a new island (like for a permalink) */
|
/** use for fragments coming out of persistence, not newly created ones, or also fragments for a new island (like for a permalink) */
|
||||||
add(fragment) {
|
add(...fragments) {
|
||||||
const copy = new Fragment(fragment.id, fragment.previousId, fragment.nextId);
|
for (const fragment of fragments) {
|
||||||
this._fragmentsById.set(fragment.id, copy);
|
const copy = new Fragment(fragment.id, fragment.previousId, fragment.nextId);
|
||||||
|
this._fragmentsById.set(fragment.id, copy);
|
||||||
|
}
|
||||||
this.rebuild(this._fragmentsById.values());
|
this.rebuild(this._fragmentsById.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue