=per #18296 Use 0L or snapshot seqNr as asyncReadHighestSequenceNr param

For example, a new persistent actor (no snapshots, no events) should use
0L so that it makes sense that journal returns 0L and the first persisted
event gets 1L.
This commit is contained in:
Patrik Nordwall 2015-08-28 16:05:59 +02:00
parent c6fdee9dc7
commit af3bc52480
4 changed files with 9 additions and 4 deletions

View file

@ -124,7 +124,8 @@ trait AsyncWriteJournal extends Actor with WriteJournalBase with AsyncRecovery {
replayFilterWindowSize, replayFilterMaxOldWriters))
else persistentActor
breaker.withCircuitBreaker(asyncReadHighestSequenceNr(persistenceId, fromSequenceNr))
val readHighestSequenceNrFrom = math.max(0L, fromSequenceNr - 1)
breaker.withCircuitBreaker(asyncReadHighestSequenceNr(persistenceId, readHighestSequenceNrFrom))
.flatMap { highSeqNr
val toSeqNr = math.min(toSequenceNr, highSeqNr)
if (highSeqNr == 0L || fromSequenceNr > toSeqNr)