From 71c6f5821bb304f6788525e2c2bd70e77cdf42ec Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 21 Oct 2023 11:51:59 +0100 Subject: [PATCH] Log IDs of artifacts as they are refreshed Signed-off-by: Graham --- .../org/openrs2/archive/client/ClientImporter.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 3dfed7b569..d1236c6c3f 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)) } }