Skip to content

Commit 5d2713c

Browse files
authored
fix: Make node download more stable (#16739)
Tries up to 5 times with a delay of 5 seconds to better deal with network issues
1 parent c4ac9c0 commit 5d2713c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎flow-server/src/main/java/com/vaadin/flow/server/frontend/installer/NodeInstaller.java‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public class NodeInstaller {
5858

5959
public static final String PROVIDED_VERSION = "provided";
6060

61-
private static final int MAX_DOWNLOAD_ATTEMPS = 3;
61+
private static final int MAX_DOWNLOAD_ATTEMPS = 5;
62+
63+
private static final int DOWNLOAD_ATTEMPT_DELAY = 5;
6264

6365
private final Object lock = new Object();
6466

@@ -522,7 +524,12 @@ private void downloadFileIfMissing(URI downloadUrl, File destination,
522524

523525
getLogger().debug("Error during downloading " + downloadUrl,
524526
e);
525-
getLogger().warn("Download failed, retrying...");
527+
getLogger().warn("Download failed, retrying in "
528+
+ DOWNLOAD_ATTEMPT_DELAY + "s...");
529+
try {
530+
Thread.sleep(DOWNLOAD_ATTEMPT_DELAY * 1000);
531+
} catch (InterruptedException e1) {
532+
}
526533
}
527534

528535
}

0 commit comments

Comments
 (0)