From 4eea6d752a5d2447593cb719933dfe1d18a39039 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 8 Jul 2022 09:48:41 +0100 Subject: [PATCH] Don't terminate if downloading keys from a source fails Signed-off-by: Graham --- .../kotlin/org/openrs2/archive/key/KeyImporter.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/archive/src/main/kotlin/org/openrs2/archive/key/KeyImporter.kt b/archive/src/main/kotlin/org/openrs2/archive/key/KeyImporter.kt index 59fe97f8..204eeb75 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/key/KeyImporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/key/KeyImporter.kt @@ -3,6 +3,7 @@ package org.openrs2.archive.key import com.github.michaelbull.logging.InlineLogger import org.openrs2.crypto.XteaKey import org.openrs2.db.Database +import java.io.IOException import java.nio.file.Files import java.nio.file.Path import java.sql.Connection @@ -75,10 +76,15 @@ public class KeyImporter @Inject constructor( for (downloader in downloaders) { for (url in downloader.getMissingUrls(seenUrls)) { - keys += downloader.download(url).map { key -> - Key(key, downloader.source) + try { + keys += downloader.download(url).map { key -> + Key(key, downloader.source) + } + urls += url + } catch (ex: IOException) { + logger.warn(ex) { "Failed to download keys from ${downloader.source.name}" } + continue } - urls += url } }