mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-06 23:52:12 +01:00
Make timeout configurable
This commit is contained in:
@@ -300,6 +300,10 @@ public final class BrowseCommandBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setComputationTimeoutMilliSeconds(long computationTimeoutMilliSeconds) {
|
||||
request.setComputationTimeoutMilliSeconds(computationTimeoutMilliSeconds);
|
||||
}
|
||||
|
||||
private void updateCache(BrowserResult updatedResult) {
|
||||
if (!disableCache) {
|
||||
CacheKey key = new CacheKey(repository, request);
|
||||
|
||||
@@ -147,6 +147,10 @@ public abstract class FileBaseCommandRequest
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public void setComputationTimeoutMilliSeconds(long computationTimeoutMilliSeconds) {
|
||||
this.computationTimeoutMilliSeconds = computationTimeoutMilliSeconds;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -171,7 +175,14 @@ public abstract class FileBaseCommandRequest
|
||||
return revision;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
public boolean isDisableCommitValues() {
|
||||
return disableCommitValues;
|
||||
}
|
||||
|
||||
public long getComputationTimeoutMilliSeconds() {
|
||||
return computationTimeoutMilliSeconds;
|
||||
}
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
@@ -208,4 +219,8 @@ public abstract class FileBaseCommandRequest
|
||||
|
||||
/** Field description */
|
||||
private String revision;
|
||||
|
||||
private boolean disableCommitValues = false;
|
||||
|
||||
private long computationTimeoutMilliSeconds = 1000;
|
||||
}
|
||||
|
||||
@@ -141,8 +141,8 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
try {
|
||||
if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) {
|
||||
logger.info("lookup of all commits took too long in repo {}", repository.getNamespaceAndName());
|
||||
if (!executorService.awaitTermination(request.getComputationTimeoutMilliSeconds(), TimeUnit.MILLISECONDS)) {
|
||||
logger.info("lookup of all commits aborted after {}ms in repo {}", request.getComputationTimeoutMilliSeconds(), repository.getNamespaceAndName());
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
@@ -259,8 +259,6 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
private RevWalk commitWalk = null;
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user