Skip to content

Commit b36594d

Browse files
committed
Correct a condition to request jobserver tokens
This looks like it was a bug ever present from the original implementation of a GNU jobserver in #4110, but we currently unconditionally request a token is allocated for any job we pull off our job queue. Rather we only need to request tokens for everything but the first job because we already have an implicit token for that job.
1 parent 21ea254 commit b36594d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
230230
// request a token.
231231
while let Some((key, job)) = self.queue.dequeue() {
232232
queue.push((key, job));
233-
if !self.active.is_empty() || !queue.is_empty() {
233+
if self.active.len() + queue.len() > 1 {
234234
jobserver_helper.request_token();
235235
}
236236
}

0 commit comments

Comments
 (0)