Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/core/Akka.Persistence/Journal/AsyncWriteJournal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,10 @@ private async Task ExecuteBatch(WriteMessages message, int atomicWriteCount, IAc
// try in case AsyncWriteMessages throws
try
{
var writeResult =
await _breaker.WithCircuitBreaker((prepared, awj: this), (state, ct) => state.awj.WriteMessagesAsync(state.prepared, ct)).ConfigureAwait(false);
// NOTE: Not using ConfigureAwait(false) to ensure continuation runs on actor's dispatcher thread.
// This ensures proper synchronization context and avoids potential race conditions and deadlocks.
var writeResult =
await _breaker.WithCircuitBreaker((prepared, awj: this), (state, ct) => state.awj.WriteMessagesAsync(state.prepared, ct));

ProcessResults(writeResult, atomicWriteCount, message, _resequencer, resequencerCounter, self);
}
Expand Down