Skip to content

Commit

Permalink
Merge pull request #12 from voxoco/seq-check
Browse files Browse the repository at this point in the history
add padding to sequence check
  • Loading branch information
jmordica authored Jan 17, 2023
2 parents 51ecb42 + c91664c commit 78d5ad4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ export class Nqlite {
try {
const s = await this.jsm.streams.info(this.app);

// If s.state.last_seq is greater than seq + snapThreshold we are too far behind and we need to die
if (s.state.last_seq > seq + this.snapThreshold) {
// If s.state.last_seq is greater than seq + snapThreshold * 2 we are too far behind and we need to die
const snapDouble = this.snapThreshold * 2;
if (s.state.last_seq > seq + snapDouble) {
console.log(
`Too far behind to catch up: ${s.state.last_seq} > ${seq} + ${this.snapThreshold}`,
`Too far behind to catch up: ${s.state.last_seq} > ${seq} + ${snapDouble}`,
);
Deno.exit(1);
}
Expand Down

0 comments on commit 78d5ad4

Please sign in to comment.