Skip to content

Commit

Permalink
Configure time out for calculation disk usage of workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Philippe Briend committed Sep 6, 2013
1 parent 0e109cc commit 2f131ae
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
target
work
*.iml
.DS_Store
.DS_Store
.idea
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public DescriptorImpl() {
// Number of days in history
private int historyLength = 183;

// Timeout for a single Project's workspace analyze (in mn)
private int timeoutWorkspace = 5;

List<DiskUsageOvearallGraphGenerator.DiskUsageRecord> history = new LinkedList<DiskUsageOvearallGraphGenerator.DiskUsageRecord>(){
private static final long serialVersionUID = 1L;

Expand All @@ -67,7 +70,10 @@ public DiskUsageProjectActionFactory newInstance(StaplerRequest req, JSONObject

@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
// Configure showGraph
showGraph = req.getParameter("disk_usage.showGraph") != null;

// Configure historyLength
String histlen = req.getParameter("disk_usage.historyLength");
if(histlen != null ){
try{
Expand All @@ -78,6 +84,18 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
}else{
historyLength = 183;
}

// Configure timeoutWorkspace
String timeoutWks = req.getParameter("disk_usage.timeoutWorkspace");
if (timeoutWks != null ) {
try {
timeoutWorkspace = Integer.parseInt(timeoutWks);
} catch (NumberFormatException ex) {
timeoutWorkspace = 5;
}
} else {
timeoutWorkspace = 5;
}
save();
return super.configure(req, formData);
}
Expand All @@ -98,6 +116,14 @@ public int getHistoryLength() {
public void setHistoryLength(Integer historyLength) {
this.historyLength = historyLength;
}

public int getTimeoutWorkspace() {
return timeoutWorkspace;
}

public void setTimeoutWorkspace(Integer timeoutWorkspace) {
this.timeoutWorkspace = timeoutWorkspace;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class DiskUsageThread extends AsyncPeriodicWork {
//trigger disk usage thread each 6 hours
public static final int COUNT_INTERVAL_MINUTES = 60*6;

public static final int WORKSPACE_TIMEOUT = 1000*60*5;
public static final int WORKSPACE_TIMEOUT = 1000*60*DiskUsageProjectActionFactory.DESCRIPTOR.getTimeoutWorkspace();


public DiskUsageThread() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
${%OverallGraphHistoryLength}
<f:textbox name="disk_usage.historyLength" value="${descriptor.historyLength}" />
</f:entry>

<f:entry title="">
${%TimeoutWorkspace}
<f:textbox name="disk_usage.timeoutWorkspace" value="${descriptor.timeoutWorkspace}" />
</f:entry>
</f:section>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
# THE SOFTWARE.

OverallGraphHistoryLength=Overall graph history length (days)
TimeoutWorkspace=Timeout to calculate size for a single project's workspace (minutes).
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
Disk\ usage=Utilisation du disque
Show\ disk\ usage\ trend\ graph\ on\ the\ project\ page=Montrer le graphique de tendance d''utilisation du disque sur la page du projet
OverallGraphHistoryLength=Taille du graphique d''historique (jours)
TimeoutWorkspace=Timeout pour calculer l''espace disque d''un workspace d''un projet (minutes).

0 comments on commit 2f131ae

Please sign in to comment.