From c2935a45dcd556a8de6084ce2e205e337a3b79ef Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 25 Aug 2024 17:09:58 +0100 Subject: [PATCH] Tweaked MySQL retries --- .../data/handlers/impl/MySQLPersistentDataHandler.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/handlers/impl/MySQLPersistentDataHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/handlers/impl/MySQLPersistentDataHandler.kt index eea96807..f61dd4ab 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/handlers/impl/MySQLPersistentDataHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/handlers/impl/MySQLPersistentDataHandler.kt @@ -10,6 +10,8 @@ import com.willfp.eco.core.data.keys.PersistentDataKey import com.willfp.eco.core.data.keys.PersistentDataKeyType import com.zaxxer.hikari.HikariConfig import com.zaxxer.hikari.HikariDataSource +import kotlinx.coroutines.delay +import kotlinx.coroutines.runBlocking import org.jetbrains.exposed.sql.Column import org.jetbrains.exposed.sql.Database import org.jetbrains.exposed.sql.SchemaUtils @@ -239,10 +241,14 @@ class MySQLPersistentDataHandler( try { return action() } catch (e: Exception) { - if (retries >= 3) { + if (retries >= 5) { throw e } retries++ + + runBlocking { + delay(10) + } } } }