diff --git a/archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt b/archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt index 3dfed7b5..d1236c6c 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt @@ -239,11 +239,13 @@ public class ClientImporter @Inject constructor( } public suspend fun refresh() { + data class Blob(val id: Long, val bytes: ByteArray) + database.execute { connection -> importer.prepare(connection) var lastId: Long? = null - val blobs = mutableListOf() + val blobs = mutableListOf() while (true) { blobs.clear() @@ -263,8 +265,9 @@ public class ClientImporter @Inject constructor( stmt.executeQuery().use { rows -> while (rows.next()) { - lastId = rows.getLong(1) - blobs += rows.getBytes(2) + val id = rows.getLong(1) + lastId = id + blobs += Blob(id, rows.getBytes(2)) } } } @@ -274,7 +277,9 @@ public class ClientImporter @Inject constructor( } for (blob in blobs) { - Unpooled.wrappedBuffer(blob).use { buf -> + logger.info { "Refreshing artifact ${blob.id}" } + + Unpooled.wrappedBuffer(blob.bytes).use { buf -> import(connection, parse(buf)) } }