From e451a583b6a051a0a88793c3eae388eda0ce59f3 Mon Sep 17 00:00:00 2001 From: red Date: Mon, 30 Oct 2023 13:44:56 +0100 Subject: [PATCH] retry on timeout --- buildSrc/src/main/kotlin/Config.kt | 2 +- src/com/j0rsa/labot/client/Anki.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 5a874bd..0b0852f 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -1,4 +1,4 @@ const val GROUP_ID = "com.j0rsa.labot" -const val VERSION = "0.0.21" +const val VERSION = "0.0.22" const val DOCKER_REGISTRY = "ghcr.io/j0rsa" const val MAIN_CLASS = "com.j0rsa.labot.Main" diff --git a/src/com/j0rsa/labot/client/Anki.kt b/src/com/j0rsa/labot/client/Anki.kt index 4f1abda..8e04924 100644 --- a/src/com/j0rsa/labot/client/Anki.kt +++ b/src/com/j0rsa/labot/client/Anki.kt @@ -38,6 +38,7 @@ class Anki( delayMillis { retry -> retry * 3000L } + retryOnException(maxRetries, true) } install(ContentNegotiation) { val json = Json { @@ -65,6 +66,7 @@ class Anki( suspend fun addNote(note: Note) = sendAction("addNote", note) suspend fun addNotes(notes: Collection) = run { + // TODO: validate that the deck exists as it won't trigger an error log.info("adding notes") val chunks = notes.chunked(10) val size = chunks.size