diff --git a/akka-projection-dynamodb/src/main/scala/akka/projection/dynamodb/internal/DynamoDBOffsetStore.scala b/akka-projection-dynamodb/src/main/scala/akka/projection/dynamodb/internal/DynamoDBOffsetStore.scala index b19cb02e7..abb19e5c7 100644 --- a/akka-projection-dynamodb/src/main/scala/akka/projection/dynamodb/internal/DynamoDBOffsetStore.scala +++ b/akka-projection-dynamodb/src/main/scala/akka/projection/dynamodb/internal/DynamoDBOffsetStore.scala @@ -391,8 +391,9 @@ private[projection] class DynamoDBOffsetStore( records .groupBy(_.pid) .valuesIterator - .map(_.maxBy(_.seqNr)) - .filterNot(oldState.isDuplicate _) + .collect { + case recordsByPid if !oldState.isDuplicate(recordsByPid.last) => recordsByPid.last + } .toVector } }