diff --git a/src/main/java/com/sheepit/client/Utils.java b/src/main/java/com/sheepit/client/Utils.java index 6e6e041..cf0b937 100644 --- a/src/main/java/com/sheepit/client/Utils.java +++ b/src/main/java/com/sheepit/client/Utils.java @@ -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); }