From c68a974a6eaedf00eca889bd870738c186ef7ef0 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Mon, 17 Jul 2017 21:26:00 +0200 Subject: [PATCH] Minor bugfix --- .../EventStore/MongoEventStore.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Squidex.Infrastructure.MongoDb/EventStore/MongoEventStore.cs b/src/Squidex.Infrastructure.MongoDb/EventStore/MongoEventStore.cs index b573c6074..3e052bc8b 100644 --- a/src/Squidex.Infrastructure.MongoDb/EventStore/MongoEventStore.cs +++ b/src/Squidex.Infrastructure.MongoDb/EventStore/MongoEventStore.cs @@ -143,11 +143,6 @@ namespace Squidex.Infrastructure.MongoDb.EventStore await plainCollection.Value.InsertManyAsync(commitsToInsert.Select(x => x.Document), new InsertManyOptions { IsOrdered = false }); notifier.NotifyEventsStored(); - - foreach (var commit in commitsToInsert) - { - commit.Completion.SetResult(true); - } } catch (MongoBulkWriteException ex) { @@ -179,6 +174,13 @@ namespace Squidex.Infrastructure.MongoDb.EventStore commit.Completion.SetException(ex); } } + finally + { + foreach (var commit in commitsToInsert) + { + commit.Completion.TrySetResult(true); + } + } } }