Skip to content

Commit

Permalink
Make queue item expiration configurable via Java system property
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Oct 22, 2024
1 parent 091953f commit 4c4efbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/model/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@
@ExportedBean
public class Queue extends ResourceController implements Saveable {

private static final int LEFT_ITEMS_CACHE_EXPIRATION_SECONDS = SystemProperties.getInteger(Queue.class.getName() + ".LEFT_ITEMS_CACHE_EXPIRATION_SECONDS", 5 * 60);
private static final int LEFT_ITEMS_CACHE_SIZE = SystemProperties.getInteger(Queue.class.getName() + ".LEFT_ITEMS_CACHE_SIZE", 10_000);

/**
* Items that are waiting for its quiet period to pass.
Expand Down Expand Up @@ -217,7 +220,7 @@ public class Queue extends ResourceController implements Saveable {
*
* This map is forgetful, since we can't remember everything that executed in the past.
*/
private final Cache<Long, LeftItem> leftItems = CacheBuilder.newBuilder().expireAfterWrite(5 * 60, TimeUnit.SECONDS).build();
private final Cache<Long, LeftItem> leftItems = CacheBuilder.newBuilder().expireAfterWrite(LEFT_ITEMS_CACHE_EXPIRATION_SECONDS, TimeUnit.SECONDS).maximumSize(LEFT_ITEMS_CACHE_SIZE).recordStats().build();

/**
* Data structure created for each idle {@link Executor}.
Expand Down

0 comments on commit 4c4efbe

Please sign in to comment.