get avoid snapshot interval calculate int overflow (#1088)
Signed-off-by: Andy.Chen <iRoiocam@gmail.com>
This commit is contained in:
parent
5e00e6b8b7
commit
7dd5d73071
1 changed files with 2 additions and 2 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue