Skip to content

Commit 2142497

Browse files
mightyiamWes Gray
andcommitted
perf(fetcher): no batch landing upsertion
Co-authored-by: Wes Gray <wes.gray@gmail.com>
1 parent 5c81cfa commit 2142497

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

crates/fetcher/src/lib.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,19 @@ async fn update_landings(
100100

101101
let commits = repo.rev_walk([head]).all()?;
102102

103-
let mut landings = Vec::new();
104-
105103
for commit in commits {
106104
let commit = commit?;
107105

108106
let git_commit: GitCommit = commit.id.to_string().into();
109-
if let Some(pr_number) = prs.get(&git_commit) {
110-
let landing = Landing {
111-
github_pr: *pr_number,
112-
branch_id: branch.id(),
113-
};
114-
115-
landings.push(landing);
116-
}
107+
let Some(pr_number) = prs.get(&git_commit) else {
108+
continue;
109+
};
110+
let landing = Landing {
111+
github_pr: *pr_number,
112+
branch_id: branch.id(),
113+
};
114+
landing.upsert(db_connection).await?;
117115
}
118116

119-
Landing::upsert_batch(db_connection, &landings).await?;
120-
121117
Ok(())
122118
}

0 commit comments

Comments
 (0)