Skip to content

Commit

Permalink
only set on primary
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jun 24, 2024
1 parent 8a4c414 commit 206fd68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion svc/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ async function scanApi(seqNum: number) {
nextSeqNum = resp[resp.length - 1].match_seq_num + 1;
console.log('next_seq_num: %s', nextSeqNum);
}
await redis.set('match_seq_num', nextSeqNum);
if (!Number(config.SCANNER_OFFSET)) {
// Only set match seq num on primary
await redis.set('match_seq_num', nextSeqNum);
}
// We might want to store this in pg eventually for consistency
// await db.raw('INSERT INTO last_seq_num(match_seq_num) VALUES (?)', [nextSeqNum]);
// If not a full page, delay the next iteration
Expand Down

0 comments on commit 206fd68

Please sign in to comment.