Skip to content

Commit

Permalink
Bugfix: ReadHighestSequenceNumber: Include results from the last requ…
Browse files Browse the repository at this point in the history
…est (when continuationToken is null) (#22)
  • Loading branch information
Daniel Tandberg Abrahamsen authored and Aaronontheweb committed Jul 5, 2019
1 parent 9444d83 commit 67d42ec
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,18 @@ public override async Task<long> ReadHighestSequenceNrAsync(string persistenceId
_log.Debug("Entering method ReadHighestSequenceNrAsync");
#endif
var sequenceNumberQuery = GenerateHighestSequenceNumberQuery(persistenceId, fromSequenceNr);
var result = await Table.ExecuteQuerySegmentedAsync(sequenceNumberQuery, null);
TableQuerySegment<PersistentJournalEntry> result = null;
long seqNo = 0L;

do
{
result = await Table.ExecuteQuerySegmentedAsync(sequenceNumberQuery, result?.ContinuationToken);

if (result.Results.Count > 0)
{
seqNo = Math.Max(seqNo, result.Results.Max(x => x.SeqNo));
}

if(result.ContinuationToken != null)
result = await Table.ExecuteQuerySegmentedAsync(sequenceNumberQuery, result.ContinuationToken);
} while (result.ContinuationToken != null);

#if DEBUG
Expand Down

0 comments on commit 67d42ec

Please sign in to comment.