Skip to content

Commit

Permalink
chore: fix duplicated add
Browse files Browse the repository at this point in the history
  • Loading branch information
zwpaper committed Nov 25, 2024
1 parent b447bf0 commit 835b5de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ impl SchedulerGithubGitlabJob {
let mut num_deleted = 0;
for await (state, doc) in issue_stream.chain(pull_stream) {
let id = &doc.id().to_owned();
if index.add(state.updated_at, doc).await {
if !state.should_clean && index.add(state.updated_at, doc).await {
num_updated += 1
}
if state.should_clean && index.delete(id).await {
num_deleted += 1;
}

println!("doc {}", id);
count += 1;
if count % 100 == 0 {
logkit::info!("{} docs seen, {} docs updated, {} docs deleted", count, num_updated, num_deleted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub async fn list_github_issues(
};
yield (FetchState {
updated_at: issue.updated_at,
should_clean: false,
should_clean: false,
}, doc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub async fn list_github_pulls(
updated_at: pull.updated_at.unwrap(),
should_clean: true,
}, doc);
continue;
}
}

Expand Down

0 comments on commit 835b5de

Please sign in to comment.