Merge branch 'IncreaseFreeSpacePolling' into 'master'
Increase and stagger free space probes See merge request sheepitrenderfarm/client!187
This commit is contained in:
@@ -209,12 +209,15 @@ public class Utils {
|
||||
public static boolean noFreeSpaceOnDisk(String destination_, Log log) {
|
||||
try {
|
||||
File file = new File(destination_);
|
||||
for (int i = 0; i < 3; i++) { //We poll repeatedly because getUsableSpace() might just return 0 on busy disk IO
|
||||
for (int i = 0; i < 5; i++) { //We poll repeatedly because getUsableSpace() might just return 0 on busy disk IO
|
||||
long space = file.getUsableSpace();
|
||||
if (space > 512 * 1024) { // at least the same amount as Server.HTTPGetFile
|
||||
return false; // If we are not "full", we are done, no need for additional polling
|
||||
} else if (i < 2) {
|
||||
long time = (long) (Math.random() * (100 - 40 + 1) + 40); //Wait between 40 and 100 milliseconds
|
||||
} else if (i < 4) {
|
||||
long time = (long) (
|
||||
Math.random() * (100 - 50 + 1) + 50 + //Wait between 50 and 100 milliseconds,
|
||||
(i * 500) //add 500 ms on each failed poll
|
||||
);
|
||||
log.debug("Utils::Not enough free disk space(" + space + ") encountered on try " + i + ", waiting " + time + "ms");
|
||||
Thread.sleep(time);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user