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

Configure time out for calculation disk usage of workspace #14

Merged
merged 1 commit into from
Sep 9, 2013
Merged
Show file tree
Hide file tree
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
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).