Skip to content

Commit 2710388

Browse files
committed
Switch to the other aproach
1 parent c1552d4 commit 2710388

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,7 @@ public CauseOfBlockage canRun(Queue.Item item) {
537537
return null;
538538
}
539539
for (Queue.Item i : items) {
540-
if (i.getId() == item.getId()) {
541-
// We've reached the current item, no need to go further
542-
break;
543-
} else if (i.getInQueueSince() <= item.getInQueueSince()) {
540+
if (i.getInQueueSince() < item.getInQueueSince()) {
544541
LOGGER.log(Level.FINE, "{0} with queue id {1} blocked by queue id {2} was first",
545542
new Object[]{
546543
job.getFullName(),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ public void rateLimitsConcurrentBuilds() throws Exception {
248248
assertThat(master.isInQueue(), is(false));
249249
assertThat(master.getQueueItem(), nullValue());
250250
QueueTaskFuture<FreeStyleBuild> future = master.scheduleBuild2(0);
251+
Thread.sleep(1);
251252
QueueTaskFuture<FreeStyleBuild> future2 = master.scheduleBuild2(0, (Cause) null,
252253
new ParametersAction(
253254
Collections.singletonList(new StringParameterValue("FOO", "MANCHU"))));

0 commit comments

Comments
 (0)