This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch 1.0.x
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git


The following commit(s) were added to refs/heads/1.0.x by this push:
     new 7356a9c198 get avoid snapshot interval calculate int overflow (#1088) 
(#1090)
7356a9c198 is described below

commit 7356a9c1986c12f6d9bb339eb8a8030553b5cda0
Author: AndyChen(JingZhangChen) <[email protected]>
AuthorDate: Thu Feb 1 10:50:51 2024 +0800

    get avoid snapshot interval calculate int overflow (#1088) (#1090)
    
    Signed-off-by: Andy.Chen <[email protected]>
---
 .../pekko/persistence/typed/internal/RetentionCriteriaImpl.scala      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RetentionCriteriaImpl.scala
 
b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RetentionCriteriaImpl.scala
index 5c125ecabf..6caa28b80d 100644
--- 
a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RetentionCriteriaImpl.scala
+++ 
b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/internal/RetentionCriteriaImpl.scala
@@ -36,14 +36,14 @@ import pekko.persistence.typed.scaladsl
 
   def deleteUpperSequenceNr(lastSequenceNr: Long): Long = {
     // Delete old events, retain the latest
-    math.max(0, lastSequenceNr - (keepNSnapshots * snapshotEveryNEvents))
+    math.max(0, lastSequenceNr - (keepNSnapshots.toLong * 
snapshotEveryNEvents))
   }
 
   def deleteLowerSequenceNr(upperSequenceNr: Long): Long = {
     // We could use 0 as fromSequenceNr to delete all older snapshots, but 
that might be inefficient for
     // large ranges depending on how it's implemented in the snapshot plugin. 
Therefore we use the
     // same window as defined for how much to keep in the retention criteria
-    math.max(0, upperSequenceNr - (keepNSnapshots * snapshotEveryNEvents))
+    math.max(0, upperSequenceNr - (keepNSnapshots.toLong * 
snapshotEveryNEvents))
   }
 
   override def withDeleteEventsOnSnapshot: SnapshotCountRetentionCriteriaImpl =


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to