Only batch update in case list is not empty (#747)

Apparently "BatchUpdateStatement" can't handle an empty data set
This commit is contained in:
schroda
2023-11-01 14:19:40 +01:00
committed by GitHub
parent 7ed8f43859
commit 5b3975f886

View File

@@ -175,6 +175,7 @@ object Chapter {
} }
} }
if (chaptersToUpdate.isNotEmpty()) {
BatchUpdateStatement(ChapterTable).apply { BatchUpdateStatement(ChapterTable).apply {
chaptersToUpdate.forEach { chaptersToUpdate.forEach {
addBatch(EntityID(it.id, ChapterTable)) addBatch(EntityID(it.id, ChapterTable))
@@ -188,6 +189,7 @@ object Chapter {
} }
execute(this@transaction) execute(this@transaction)
} }
}
MangaTable.update({ MangaTable.id eq mangaId }) { MangaTable.update({ MangaTable.id eq mangaId }) {
it[MangaTable.chaptersLastFetchedAt] = Instant.now().epochSecond it[MangaTable.chaptersLastFetchedAt] = Instant.now().epochSecond