Skip to content

Commit 9642be6

Browse files
authored
Update scanner.ts
1 parent 1edfd86 commit 9642be6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

svc/scanner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ async function scanApi(seqNum: number) {
4747
const resp =
4848
data && data.result && data.result.matches ? data.result.matches : [];
4949
console.log('[API] match_seq_num:%s, matches:%s', nextSeqNum, resp.length);
50+
console.time('insert');
5051
await Promise.all(resp.map((match: ApiMatch) => processMatch(match)));
52+
console.timeEnd('insert');
5153
// Completed inserting matches on this page so update redis
5254
if (resp.length) {
5355
nextSeqNum = resp[resp.length - 1].match_seq_num + 1;
@@ -88,6 +90,7 @@ async function processMatch(match: ApiMatch) {
8890
origin: 'scanner',
8991
});
9092
await redis.zadd('scanner_insert', match.match_id, match.match_id);
93+
// To avoid dups we should always keep more matches here than SCANNER_OFFSET
9194
await redis.zremrangebyrank('scanner_insert', '0', '-100000');
9295
}
9396
}

0 commit comments

Comments
 (0)