This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-r2dbc.git
The following commit(s) were added to refs/heads/main by this push:
new 2680b6a use scala.jdk.DurationConverter (#459)
2680b6a is described below
commit 2680b6a91e917d1750873adcc35239dd1f83d45f
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Jul 27 15:42:14 2026 +0100
use scala.jdk.DurationConverter (#459)
---
.../persistence/r2dbc/ConnectionFactoryProvider.scala | 17 +++++++++--------
.../pekko/persistence/r2dbc/internal/BySliceQuery.scala | 5 +++--
.../r2dbc/query/scaladsl/R2dbcReadJournal.scala | 3 ++-
.../r2dbc/query/EventsBySlicePubSubSpec.scala | 4 ++--
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryProvider.scala
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryProvider.scala
index a65c410..5bca510 100644
---
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryProvider.scala
+++
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryProvider.scala
@@ -19,6 +19,7 @@ import java.util.concurrent.ConcurrentHashMap
import scala.concurrent.Future
import scala.concurrent.duration.Duration
import scala.jdk.CollectionConverters._
+import scala.jdk.DurationConverters._
import scala.util.Failure
import scala.util.Success
@@ -137,7 +138,7 @@ class ConnectionFactoryProvider(system: ActorSystem[?])
extends Extension {
.option(ConnectionFactoryOptions.USER, settings.user)
.option(ConnectionFactoryOptions.PASSWORD, settings.password)
.option(ConnectionFactoryOptions.DATABASE, settings.database)
- .option(ConnectionFactoryOptions.CONNECT_TIMEOUT,
JDuration.ofMillis(settings.connectTimeout.toMillis))
+ .option(ConnectionFactoryOptions.CONNECT_TIMEOUT,
settings.connectTimeout.toJava)
}
builder
@@ -148,7 +149,7 @@ class ConnectionFactoryProvider(system: ActorSystem[?])
extends Extension {
Integer.valueOf(settings.statementCacheSize))
settings.statementTimeout.foreach { timeout =>
- builder.option(PostgresqlConnectionFactoryProvider.STATEMENT_TIMEOUT,
JDuration.ofMillis(timeout.toMillis))
+ builder.option(PostgresqlConnectionFactoryProvider.STATEMENT_TIMEOUT,
timeout.toJava)
}
if (settings.sslEnabled) {
@@ -190,11 +191,11 @@ class ConnectionFactoryProvider(system: ActorSystem[?])
extends Extension {
if (maxIdleTime <= Duration.Zero && maxLifeTime <= Duration.Zero) {
JDuration.ZERO
} else if (maxIdleTime <= Duration.Zero) {
- JDuration.ofMillis((maxLifeTime / 4).toMillis)
+ (maxLifeTime / 4).toJava
} else if (maxLifeTime <= Duration.Zero) {
- JDuration.ofMillis((maxIdleTime / 4).toMillis)
+ (maxIdleTime / 4).toJava
} else {
- JDuration.ofMillis((maxIdleTime.min(maxIdleTime) / 4).toMillis)
+ (maxIdleTime.min(maxIdleTime) / 4).toJava
}
}
@@ -204,10 +205,10 @@ class ConnectionFactoryProvider(system: ActorSystem[?])
extends Extension {
.maxSize(settings.maxSize)
// Don't use maxCreateConnectionTime because it can cause connection
leaks, see issue #182
// ConnectionFactoryOptions.CONNECT_TIMEOUT is used instead.
- .maxAcquireTime(JDuration.ofMillis(settings.acquireTimeout.toMillis))
+ .maxAcquireTime(settings.acquireTimeout.toJava)
.acquireRetry(settings.acquireRetry)
- .maxIdleTime(JDuration.ofMillis(settings.maxIdleTime.toMillis))
- .maxLifeTime(JDuration.ofMillis(settings.maxLifeTime.toMillis))
+ .maxIdleTime(settings.maxIdleTime.toJava)
+ .maxLifeTime(settings.maxLifeTime.toJava)
.backgroundEvictionInterval(evictionInterval)
if (settings.validationQuery.nonEmpty)
diff --git
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/internal/BySliceQuery.scala
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/internal/BySliceQuery.scala
index 8789e69..893adaf 100644
---
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/internal/BySliceQuery.scala
+++
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/internal/BySliceQuery.scala
@@ -22,6 +22,7 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.duration.Duration
import scala.concurrent.duration.FiniteDuration
+import scala.jdk.DurationConverters._
import org.apache.pekko
import pekko.NotUsed
import pekko.annotation.InternalApi
@@ -202,10 +203,10 @@ import org.slf4j.Logger
import BySliceQuery._
import TimestampOffset.toTimestampOffset
- private val backtrackingWindow =
JDuration.ofMillis(settings.backtrackingWindow.toMillis)
+ private val backtrackingWindow = settings.backtrackingWindow.toJava
private val halfBacktrackingWindow = backtrackingWindow.dividedBy(2)
private val firstBacktrackingQueryWindow =
-
backtrackingWindow.plus(JDuration.ofMillis(settings.backtrackingBehindCurrentTime.toMillis))
+ backtrackingWindow.plus(settings.backtrackingBehindCurrentTime.toJava)
private val eventBucketCountInterval = JDuration.ofSeconds(60)
def currentBySlices(
diff --git
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
index 3a2d931..a1c1af9 100644
---
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
+++
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
@@ -20,6 +20,7 @@ import scala.collection.immutable
import scala.collection.mutable
import scala.concurrent.Future
import scala.concurrent.duration.FiniteDuration
+import scala.jdk.DurationConverters._
import com.typesafe.config.Config
import org.apache.pekko
import pekko.NotUsed
@@ -194,7 +195,7 @@ final class R2dbcReadJournal(system: ExtendedActorSystem,
config: Config, cfgPat
dbSource
.mergePrioritized(pubSubSource, leftPriority = 1, rightPriority = 10)
.via(skipPubSubTooFarAhead(settings.backtrackingEnabled,
- JDuration.ofMillis(settings.backtrackingWindow.toMillis)))
+ settings.backtrackingWindow.toJava))
.via(deduplicate(settings.deduplicateCapacity))
} else
dbSource
diff --git
a/core/src/test/scala/org/apache/pekko/persistence/r2dbc/query/EventsBySlicePubSubSpec.scala
b/core/src/test/scala/org/apache/pekko/persistence/r2dbc/query/EventsBySlicePubSubSpec.scala
index 34d8614..6209fe8 100644
---
a/core/src/test/scala/org/apache/pekko/persistence/r2dbc/query/EventsBySlicePubSubSpec.scala
+++
b/core/src/test/scala/org/apache/pekko/persistence/r2dbc/query/EventsBySlicePubSubSpec.scala
@@ -14,11 +14,11 @@
package org.apache.pekko.persistence.r2dbc.query
import java.time.Instant
-import java.time.{ Duration => JDuration }
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.collection.immutable
+import scala.jdk.DurationConverters._
import org.apache.pekko
import pekko.Done
@@ -209,7 +209,7 @@ class EventsBySlicePubSubSpec
}
"skipPubSubTooFarAhead" in {
- val backtrackingWindow =
JDuration.ofMillis(querySettings.backtrackingWindow.toMillis)
+ val backtrackingWindow = querySettings.backtrackingWindow.toJava
val (in, out) =
TestSource[EventEnvelope[String]]()
.via(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]