Closed rcknight closed 6 months ago
I think we should enumerate right away, so any error in the enumerator will fail before even going further.
I think we should enumerate right away, so any error in the enumerator will fail before even going further.
Not sure that would entirely solve the issue ... a broken enumerable was a convenient way to make it fail from outside, but if for example the write call can throw you'd have the same issue https://github.com/EventStore/EventStore-Client-Dotnet/blob/master/src/EventStore.Client.Streams/EventStoreClient.Append.cs#LL112C33-L112C33
True, I didn't look into that. Good point 👍
Describe the bug When calling
AppendToStreamAsync
, and something throws midway through writing the events, events to that point will be written to the DB. This appears to be because of the use of afinally
block to commit the events here: https://github.com/EventStore/EventStore-Client-Dotnet/blob/master/src/EventStore.Client.Streams/EventStoreClient.Append.cs#L124-L127This only happens when supplying credentials to the append call, which bypasses the batch appender and sends it down this broken codepath (not sure what other circumstances that batch appender is "unusable": https://github.com/EventStore/EventStore-Client-Dotnet/blob/master/src/EventStore.Client.Streams/EventStoreClient.Append.cs#L79
To Reproduce Steps to reproduce the behavior:
Simple reproduction with a purposefully dodgy IEnumerable:
Expected behavior No events are written if an exception occurs halfway through processing the
IEnumerable
Actual behavior Events processed up to that point are written to the database.
Config/Logs/Screenshots If applicable, please attach your node configuration, logs or any screenshots.
EventStore details
DEV-125