Skip to content

Commit 70e7b96

Browse files
authored
Merge pull request #52 from pietroalbini/let-rla-speak
Send at least one notification per build
2 parents d25d5fc + 0cc7bcb commit 70e7b96

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/bin/server/worker.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct Worker {
3030
extract_config: rla::extract::Config,
3131
github: rla::github::Client,
3232
queue: crossbeam::channel::Receiver<QueueItem>,
33-
seen: VecDeque<u64>,
33+
notified: VecDeque<u64>,
3434
ci: Box<dyn CiPlatform + Send>,
3535
repo: String,
3636
secondary_repos: Vec<String>,
@@ -66,7 +66,7 @@ impl Worker {
6666
index_file,
6767
extract_config: Default::default(),
6868
github: rla::github::Client::new()?,
69-
seen: VecDeque::new(),
69+
notified: VecDeque::new(),
7070
queue,
7171
ci,
7272
repo,
@@ -133,8 +133,8 @@ impl Worker {
133133

134134
info!("started processing");
135135

136-
if self.seen.contains(&build_id) {
137-
info!("ignoring recently seen id");
136+
if self.notified.contains(&build_id) {
137+
info!("ignoring recently notified build");
138138
return Ok(());
139139
}
140140
let query_from = if self.query_builds_from_primary_repo {
@@ -159,15 +159,15 @@ impl Worker {
159159
}
160160

161161
// Avoid processing the same build multiple times.
162-
info!("marked as seen");
163-
self.seen.push_front(build_id);
164-
if self.seen.len() > KEEP_IDS {
165-
self.seen.pop_back();
166-
}
167-
168162
if !outcome.is_passed() {
169163
info!("preparing report");
170164
self.report_failed(build.as_ref())?;
165+
166+
info!("marked as notified");
167+
self.notified.push_front(build_id);
168+
if self.notified.len() > KEEP_IDS {
169+
self.notified.pop_back();
170+
}
171171
}
172172
if build.pr_number().is_none() && build.branch_name() == "auto" {
173173
info!("learning from the log");

0 commit comments

Comments
 (0)