Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make queue item expiration configurable via Java system property #9901

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading