use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class Executor method isLikelyStuck.
/**
* Returns true if the current build is likely stuck.
*
* <p>
* This is a heuristics based approach, but if the build is suspiciously taking for a long time,
* this method returns true.
*/
@Exported
public boolean isLikelyStuck() {
Queue.Executable e = executable;
if (e == null)
return false;
long elapsed = getElapsedTime();
long d = Executables.getEstimatedDurationFor(e);
if (d >= 0) {
// if it's taking 10 times longer than ETA, consider it stuck
return d * 10 < elapsed;
} else {
// if no ETA is available, a build taking longer than a day is considered stuck
return TimeUnit2.MILLISECONDS.toHours(elapsed) > 24;
}
}
Aggregations