Add JobPriority::Foreground

This commit is contained in:
Wojciech Kozlowski 2024-09-22 10:39:31 +02:00
parent d6f4b2b6b7
commit 6124572c02

View File

@ -35,7 +35,6 @@ impl Job {
#[derive(Debug)] #[derive(Debug)]
enum JobPriority { enum JobPriority {
#[cfg(test)]
Foreground, Foreground,
Background, Background,
} }
@ -298,22 +297,12 @@ impl JobQueue {
.or_else(|| self.background_queue.pop_front()) .or_else(|| self.background_queue.pop_front())
} }
#[cfg(test)]
fn push_back(&mut self, job: Job) { fn push_back(&mut self, job: Job) {
match job.priority { match job.priority {
JobPriority::Foreground => self.foreground_queue.push_back(job.instance), JobPriority::Foreground => self.foreground_queue.push_back(job.instance),
JobPriority::Background => self.background_queue.push_back(job.instance), JobPriority::Background => self.background_queue.push_back(job.instance),
} }
} }
// GRCOV_EXCL_START
#[cfg(not(test))]
fn push_back(&mut self, job: Job) {
match job.priority {
JobPriority::Background => self.background_queue.push_back(job.instance),
}
}
// GRCOV_EXCL_STOP
} }
#[cfg(test)] #[cfg(test)]