jet / equinox

.NET event sourcing library with CosmosDB, DynamoDB, EventStoreDB, message-db, SqlStreamStore and integration test backends. Focused at stream level; see https://github.com/jet/propulsion for cross-stream projections/subscriptions/reactions

Home Page:https://github.com/jet/dotnet-templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MemoryStore publishing Committed out of data causal order

fnipo opened this issue · comments

MemoryStore.fs is publishing Committed out of data causal order

Commited publishing LOC

I did an workaround on a local version that mitigated the issue
By wrapping the streams ConcurrentDictionary with a lock, it enforces sequential operations on the dictionary and consequently sequential Commited publishings.

It also means a ConcurrentDictionary is not needed anymore

Below is the change done on this LOC

let update () =
    let res = streams.AddOrUpdate(streamName, seedStream, updateValue) |> Written
    // raise here, once, as updateValue can conceptually be invoked multiple times
    committed.Trigger((FsCodec.StreamName.parse streamName, events))
    res
try lock streams update

See also #264

Released in 2.4.0 on /v2, also on master