Skip to content

Commit

Permalink
Tweaked MySQL retries
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Aug 25, 2024
1 parent 1338c0f commit c2935a4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -239,10 +241,14 @@ class MySQLPersistentDataHandler(
try {
return action()
} catch (e: Exception) {
if (retries >= 3) {
if (retries >= 5) {
throw e
}
retries++

runBlocking {
delay(10)
}
}
}
}
Expand Down

0 comments on commit c2935a4

Please sign in to comment.