Skip to content

Commit

Permalink
Fix CurrentEventsByTag never completes (#379)
Browse files Browse the repository at this point in the history
* Fix CurrentEventsByTag never completes

* Fix off by one and empty case
  • Loading branch information
Arkatufus authored Jul 12, 2024
1 parent 2f423b6 commit d6083bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Akka.Persistence.MongoDb/Query/EventsByTagPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected override void ReceiveInitialRequest()
protected override void ReceiveIdleRequest()
{
Buffer.DeliverBuffer(TotalDemand);
if (Buffer.IsEmpty && CurrentOffset > ToOffset)
if (Buffer.IsEmpty && CurrentOffset >= ToOffset)
OnCompleteThenStop();
else
Self.Tell(EventsByTagPublisher.Continue.Instance);
Expand All @@ -228,7 +228,7 @@ protected override void ReceiveRecoverySuccess(long highestSequenceNr)
if (highestSequenceNr > 0 && highestSequenceNr < ToOffset)
_toOffset = highestSequenceNr;

if (Buffer.IsEmpty && CurrentOffset > ToOffset)
if (Buffer.IsEmpty && (CurrentOffset >= ToOffset || CurrentOffset == FromOffset))
OnCompleteThenStop();
else
Self.Tell(EventsByTagPublisher.Continue.Instance);
Expand Down

0 comments on commit d6083bb

Please sign in to comment.