=sha #20315 make sharding snapshotting based on seqNr, not counter (#20319)

This commit is contained in:
Konrad Malawski 2016-05-05 16:21:24 +02:00
parent 1f8225087f
commit d24c1e0ede
3 changed files with 9 additions and 9 deletions

View file

@ -321,8 +321,6 @@ private[akka] class PersistentShard(
override def snapshotPluginId: String = settings.snapshotPluginId
var persistCount = 0
// would be initialized after recovery completed
override def initialized(): Unit = {}
@ -334,8 +332,7 @@ private[akka] class PersistentShard(
}
def saveSnapshotWhenNeeded(): Unit = {
persistCount += 1
if (persistCount % snapshotAfter == 0) {
if (lastSequenceNr % snapshotAfter == 0 && lastSequenceNr != 0) {
log.debug("Saving snapshot, sequence number [{}]", snapshotSequenceNr)
saveSnapshot(state)
}