Skip to content

Commit bef10d1

Browse files
committed
Fix duplicated message
1 parent 277d9ba commit bef10d1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/update.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ async fn update_chat_repo_pr(
146146
pr: u64,
147147
settings: &PullRequestSettings,
148148
) -> Result<(), CommandError> {
149+
let _guard = resources.commit_lock(pr.to_string()).await;
150+
// check again commit existence after acquiring the lock
151+
{
152+
let settings = resources.settings.read().await;
153+
if !settings.pull_requests.contains_key(&pr) {
154+
return Ok(())
155+
}
156+
}
157+
149158
let result = chat::pr_check(resources, repo_resources, pr).await?;
150159
log::info!("finished pr check ({chat}, {repo}, {pr})");
151160
if let Some(commit) = result {
@@ -166,6 +175,15 @@ async fn update_chat_repo_commit(
166175
commit: &str,
167176
settings: &CommitSettings,
168177
) -> Result<(), CommandError> {
178+
let _guard = resources.commit_lock(commit.to_string()).await;
179+
// check again commit existence after acquiring the lock
180+
{
181+
let settings = resources.settings.read().await;
182+
if !settings.commits.contains_key(commit) {
183+
return Ok(())
184+
}
185+
}
186+
169187
let result = chat::commit_check(resources, repo_resources, commit).await?;
170188
log::info!("finished commit check ({chat}, {repo}, {commit})");
171189
if !result.new.is_empty() {

0 commit comments

Comments
 (0)