Skip to content

Commit 442f98c

Browse files
committed
Retry up to 4 times to update Debian packages (#75)
1 parent c498099 commit 442f98c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/jsMain/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,13 @@ abstract class AptGetBasedDistribution : Distribution {
210210
}
211211

212212
override suspend fun update() {
213-
refresh()
213+
update(true)
214+
}
215+
216+
protected suspend fun update(refresh: Boolean) {
217+
if (refresh) {
218+
refresh()
219+
}
214220
exec(
215221
commandLine = "wsl",
216222
args = arrayOf(
@@ -302,7 +308,14 @@ object Debian : AptGetBasedDistribution(
302308
version = SemVer("1.0.0"),
303309
downloadUrl = URL("https://aka.ms/wsl-debian-gnulinux"),
304310
installerFile = "debian.exe"
305-
)
311+
) {
312+
override suspend fun update() {
313+
refresh()
314+
retry(5) {
315+
update(false)
316+
}
317+
}
318+
}
306319

307320
object Kali : AptGetBasedDistribution(
308321
wslId = "MyDistribution",

0 commit comments

Comments
 (0)