Skip to content

Commit 0ce9374

Browse files
committed
perf: ⚡️ emit operation to pubsub ASAP
1 parent 9330a8b commit 0ce9374

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/json-crdt-repo/local/level/LevelLocalRepo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,15 +775,15 @@ export class LevelLocalRepo implements LocalRepo {
775775
const op: BinStrLevelOperation = {type: 'put', key: patchKey, value: uint8};
776776
ops.push(op);
777777
}
778+
if (writtenPatches.length) {
779+
this.pubsub.pub({type: 'rebase', id, patches: writtenPatches, session: req.session});
780+
}
778781
if (ops.length) {
779782
await this.kv.batch(ops);
780783
return true;
781784
}
782785
return false;
783786
});
784-
if (writtenPatches.length) {
785-
this.pubsub.pub({type: 'rebase', id, patches: writtenPatches, session: req.session});
786-
}
787787
if (!didPush && !needsReset) {
788788
const merge = await this.readFrontier0(keyBase);
789789
return {cursor, merge};

0 commit comments

Comments
 (0)