Skip to content

Conversation

@kmayoral
Copy link
Collaborator

Relates to #85, this is an attempt to break out that massive PR into smaller chunks, starting with the changes required to resolve the integration test errors on the current main branch described in this comment.

This PR makes the following changes:

  • adds missing reactor-core dependency in the mongodb based plugin which is required to build and run the module and tests
    (https://github.com/crackthecodeabhi/kreds/blob/main/build.gradle.kts#L74-L76) as api instead of implementation.
  • adds serialization codec for the MongoDbTaskLock class required to build and run the mongo based plugin tests
  • adds missing transitive dependencies required by the kreds test dependency in the redis based plugin which is a result of the kreds gradle file not specifying these [dependencies]

@kmayoral
Copy link
Collaborator Author

Working off this PR branch, I took a stab again at updating Exposed from 0.44.0 to 0.60.0 only to reproduce the same test failures I saw previously where the jdbc lock manager integration tests all failed.

After testing a few Exposed release versions, I was able to isolate the Exposed release that causes the tests to start failing!

When updating to Exposed 0.58.0, the tests still all pass but once I updated to 0.59.0, all of the jdbc tests started failing. I don't see anything in the changelog for that version that immediately jumps out to me, but I am curious to look into this change in case it's related.

Working Diff

diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 3c30c6b..10dea40 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -16,7 +16,7 @@ android = "8.1.0"
 # Database
 h2 = "2.2.224"
 postgres = "42.6.0"
-exposed = "0.44.0"
+exposed = "0.58.0"
 mongodb = "5.2.0"
 
 # Logging
diff --git a/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt b/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
index 8082a44..dd09391 100644
--- a/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
+++ b/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
@@ -59,7 +59,7 @@ public class JdbcLockManager(
             database,
             transactionIsolation = Connection.TRANSACTION_READ_COMMITTED,
         ) {
-            repetitionAttempts = 0
+            maxAttempts = 1
             debug = true
             taskLockTable.insertIgnore {
                 it[name] = task.name

Screenshot 2025-03-19 at 10 33 30 AM

Failing Diff

diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 3c30c6b..10dea40 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -16,7 +16,7 @@ android = "8.1.0"
 # Database
 h2 = "2.2.224"
 postgres = "42.6.0"
-exposed = "0.44.0"
+exposed = "0.59.0"
 mongodb = "5.2.0"
 
 # Logging
diff --git a/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt b/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
index 8082a44..dd09391 100644
--- a/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
+++ b/ktor-server-task-scheduling/ktor-server-task-scheduling-jdbc/src/jvmMain/kotlin/io/github/flaxoos/ktor/server/plugins/taskscheduling/managers/lock/database/JdbcLockManager.kt
@@ -59,7 +59,7 @@ public class JdbcLockManager(
             database,
             transactionIsolation = Connection.TRANSACTION_READ_COMMITTED,
         ) {
-            repetitionAttempts = 0
+            maxAttempts = 1
             debug = true
             taskLockTable.insertIgnore {
                 it[name] = task.name

Screenshot 2025-03-19 at 10 31 16 AM

Copy link
Owner

@Flaxoos Flaxoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Flaxoos Flaxoos merged commit 30cbed5 into Flaxoos:main Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants