Don't terminate if downloading keys from a source fails

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 2 years ago
parent e804fdc065
commit 4eea6d752a
  1. 12
      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)) {
keys += downloader.download(url).map { key -> try {
Key(key, downloader.source) 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
} }
} }

Loading…
Cancel
Save