Skip to content

Commit 5d691a8

Browse files
authored
Merge pull request #383 from Vlatombe/simplify-rate-limit-queue-check
`RateLimitBranchProperty`: Fix checking queue for other items tied to the same task
2 parents f1f275d + f9e35c4 commit 5d691a8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/jenkins/branch/RateLimitBranchProperty.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public CauseOfBlockage canRun(Queue.Item item) {
537537
return null;
538538
}
539539
for (Queue.Item i : items) {
540-
if (i.getId() < item.getId()) {
540+
if (i.getInQueueSince() < item.getInQueueSince()) {
541541
LOGGER.log(Level.FINE, "{0} with queue id {1} blocked by queue id {2} was first",
542542
new Object[]{
543543
job.getFullName(),

src/test/java/jenkins/branch/RateLimitBranchPropertyTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.util.Collections;
4444
import java.util.concurrent.Future;
4545
import java.util.concurrent.TimeUnit;
46+
import java.util.logging.Level;
4647
import java.util.logging.Logger;
4748
import jenkins.scm.impl.mock.MockSCMController;
4849
import jenkins.scm.impl.mock.MockSCMDiscoverBranches;
@@ -51,6 +52,7 @@
5152
import org.junit.ClassRule;
5253
import org.junit.Test;
5354
import org.jvnet.hudson.test.JenkinsRule;
55+
import org.jvnet.hudson.test.LoggerRule;
5456
import org.jvnet.hudson.test.TestExtension;
5557

5658
import static org.hamcrest.MatcherAssert.assertThat;
@@ -84,6 +86,9 @@ public class RateLimitBranchPropertyTest {
8486
*/
8587
@ClassRule
8688
public static JenkinsRule r = new JenkinsRule();
89+
90+
@ClassRule
91+
public static LoggerRule loggerRule = new LoggerRule().record(RateLimitBranchProperty.class, Level.FINE);
8792
/**
8893
* Our logger.
8994
*/

0 commit comments

Comments
 (0)