Skip to content

Commit

Permalink
check for missing blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Bossett committed Sep 4, 2024
1 parent 5cb7de6 commit 5ed582d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/util/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ export abstract class FirehoseSubscriptionBase {
const commit = evt as Commit

if (Array.isArray(commit.ops) && commit.ops.length > 0) {
const [collection] = commit.ops[0].path.split('/')
if (includedRecords.has(collection)) {
try {
this.handleEvent(evt) // no longer awaiting this
} catch (err) {
console.error('repo subscription could not handle message', err)
if (commit.blocks) {
const [collection] = commit.ops[0].path.split('/')

if (includedRecords.has(collection)) {
try {
this.handleEvent(evt) // no longer awaiting this
} catch (err) {
console.error('repo subscription could not handle message', err)
}
}
// update stored cursor every 100 events or so
if (isCommit(evt) && evt.seq % 100 === 0) {
await this.updateCursor(evt.seq)
}
}
// update stored cursor every 100 events or so
if (isCommit(evt) && evt.seq % 100 === 0) {
await this.updateCursor(evt.seq)
}
}
}
Expand Down

0 comments on commit 5ed582d

Please sign in to comment.