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

Versioning: don't wait for indexer before refresh #8202

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
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
public final class DelayScanRegistry {
private final WeakHashMap<RequestProcessor.Task, DelayedScan> registry;
private static DelayScanRegistry instance;
private static int MAX_WAITING_TIME = 180000; // wait max 3 mins
private static int WAITING_PERIOD = 10000;
private static final int MAX_WAITING_TIME = 180000; // wait max 3 mins
private static final int WAITING_PERIOD = 10000;
private static final boolean BLOCK_INDEFINITELY = "true".equals(System.getProperty("versioning.delayscan.nolimit", "false")); //NOI18N
private static final boolean NO_DELAY = "true".equals(System.getProperty("versioning.delayscan.disable", "false")); //NOI18N

public static synchronized DelayScanRegistry getInstance() {
if (instance == null) {
Expand All @@ -47,7 +48,7 @@ public static synchronized DelayScanRegistry getInstance() {
}

private DelayScanRegistry () {
registry = new WeakHashMap<Task, DelayedScan>(5);
registry = new WeakHashMap<>(5);
}

/**
Expand All @@ -69,7 +70,7 @@ public boolean isDelayed (RequestProcessor.Task task, Logger logger, String logM
// not interested
}
}
if (IndexingBridge.getInstance().isIndexingInProgress()
if (!NO_DELAY && IndexingBridge.getInstance().isIndexingInProgress()
&& (BLOCK_INDEFINITELY || scan.waitingLoops * WAITING_PERIOD < MAX_WAITING_TIME)) {
// do not steal disk from openning projects and indexing tasks
Level level = ++scan.waitingLoops < 10 ? Level.FINE : Level.INFO;
Expand All @@ -84,11 +85,7 @@ public boolean isDelayed (RequestProcessor.Task task, Logger logger, String logM

private DelayedScan getRegisteredScan(Task task) {
synchronized (registry) {
DelayedScan scan = registry.get(task);
if (scan == null) {
registry.put(task, scan = new DelayedScan());
}
return scan;
return registry.computeIfAbsent(task, k -> new DelayedScan());
}
}

Expand Down
Loading