Log IDs of artifacts as they are refreshed

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 7 months ago
parent 6fdf31594d
commit 71c6f5821b
  1. 13
      archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt

@ -239,11 +239,13 @@ public class ClientImporter @Inject constructor(
} }
public suspend fun refresh() { public suspend fun refresh() {
data class Blob(val id: Long, val bytes: ByteArray)
database.execute { connection -> database.execute { connection ->
importer.prepare(connection) importer.prepare(connection)
var lastId: Long? = null var lastId: Long? = null
val blobs = mutableListOf<ByteArray>() val blobs = mutableListOf<Blob>()
while (true) { while (true) {
blobs.clear() blobs.clear()
@ -263,8 +265,9 @@ public class ClientImporter @Inject constructor(
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
while (rows.next()) { while (rows.next()) {
lastId = rows.getLong(1) val id = rows.getLong(1)
blobs += rows.getBytes(2) lastId = id
blobs += Blob(id, rows.getBytes(2))
} }
} }
} }
@ -274,7 +277,9 @@ public class ClientImporter @Inject constructor(
} }
for (blob in blobs) { 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)) import(connection, parse(buf))
} }
} }

Loading…
Cancel
Save