Don't terminate if downloading keys from a source fails

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent e804fdc065
commit 4eea6d752a
  1. 6
      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 com.github.michaelbull.logging.InlineLogger
import org.openrs2.crypto.XteaKey import org.openrs2.crypto.XteaKey
import org.openrs2.db.Database import org.openrs2.db.Database
import java.io.IOException
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import java.sql.Connection import java.sql.Connection
@ -75,10 +76,15 @@ public class KeyImporter @Inject constructor(
for (downloader in downloaders) { for (downloader in downloaders) {
for (url in downloader.getMissingUrls(seenUrls)) { for (url in downloader.getMissingUrls(seenUrls)) {
try {
keys += downloader.download(url).map { key -> keys += downloader.download(url).map { key ->
Key(key, downloader.source) Key(key, downloader.source)
} }
urls += url urls += url
} catch (ex: IOException) {
logger.warn(ex) { "Failed to download keys from ${downloader.source.name}" }
continue
}
} }
} }

Loading…
Cancel
Save