Skip to content

Commit 53e8656

Browse files
committed
move commit key set to earlier
1 parent 4930839 commit 53e8656

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/util/state.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ export class RedisDedupeIndex {
290290

291291
async commitDedupeDone(crawlId?: string) {
292292
crawlId = crawlId || this.crawlId;
293+
294+
// set this first, as crawl is considered 'committed' as soon
295+
// as data is partially merged in
296+
await this.dedupeRedis.srem(DUPE_UNCOMMITTED, crawlId);
297+
await this.dedupeRedis.sadd(DUPE_ALL_CRAWLS, crawlId);
298+
293299
for await (const hashes of this.dedupeRedis.hscanStream(`h:${crawlId}`)) {
294300
let isValue = false;
295301
for (const hash of hashes) {
@@ -316,10 +322,6 @@ export class RedisDedupeIndex {
316322
}
317323
}
318324

319-
// add to crawls list
320-
await this.dedupeRedis.srem(DUPE_UNCOMMITTED, crawlId);
321-
await this.dedupeRedis.sadd(DUPE_ALL_CRAWLS, crawlId);
322-
323325
// add counts
324326
await this.addCrawlCounts(crawlId);
325327
}

0 commit comments

Comments
 (0)