File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments