Add comment

This commit is contained in:
Arnaud Burlet 2020-02-11 13:30:51 +01:00
parent 6b23195385
commit 6c4aca1657
No known key found for this signature in database
GPG key ID: EBFDB1E7634062B7

View file

@ -69,8 +69,12 @@ trait AsyncWriteJournal extends Actor with WriteJournalBase with AsyncRecovery {
val atomicWriteCount = messages.count(_.isInstanceOf[AtomicWrite])
val prepared = Try(preparePersistentBatch(messages))
val writeResult = (prepared match {
case Success(prep) if prep.isEmpty => Future.successful(Nil)
case Success(prep) =>
case Success(prep) if prep.isEmpty =>
// prep is empty when all messages are instances of NonPersistentRepr (used for defer) in that case,
// we continue right away without calling the journal plugin (most plugins fail calling head on empty Seq).
// Ordering of the replies is handled by Resequencer
Future.successful(Nil)
case Success(prep) =>
// try in case the asyncWriteMessages throws
try breaker.withCircuitBreaker(asyncWriteMessages(prep))
catch { case NonFatal(e) => Future.failed(e) }