Skip to content

ConcurrencyException reports an incorrect expected revision number. #61

@ElasticCoder

Description

@ElasticCoder

The InMemoryStorageEngine reports an incorrect expected revision number. It is off by 1.

if (firstEvent.EventNumber - 1 != streams[streamId].Count)
{
    throw new ConcurrencyException($"Concurrency conflict when appending to stream {streamId}. Expected revision {firstEvent.EventNumber} : Actual revision {streams[streamId].Count}");
}

It shoud read:

if (firstEvent.EventNumber != streams[streamId].Count + 1)
{
    throw new ConcurrencyException($"Concurrency conflict when appending to stream {streamId}. Expected revision {firstEvent.EventNumber} : Actual revision {streams[streamId].Count + 1}");
}

throw new ConcurrencyException($"Concurrency conflict when appending to stream {streamId}. Expected revision {firstEvent.EventNumber} : Actual revision {streams[streamId].Count}");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions