diff --git a/Be.Vlaanderen.Basisregisters.ProjectionHandling.sln.DotSettings b/Be.Vlaanderen.Basisregisters.ProjectionHandling.sln.DotSettings index de7d776..09d4bdd 100644 --- a/Be.Vlaanderen.Basisregisters.ProjectionHandling.sln.DotSettings +++ b/Be.Vlaanderen.Basisregisters.ProjectionHandling.sln.DotSettings @@ -1,4 +1,5 @@  + ERROR True <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing.csproj.DotSettings b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing.csproj.DotSettings new file mode 100644 index 0000000..89316e4 --- /dev/null +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing.csproj.DotSettings @@ -0,0 +1,2 @@ + + Library \ No newline at end of file diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/ConnectedProjectionScenarioExtensions.cs b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/ConnectedProjectionScenarioExtensions.cs index f6cc069..80936e2 100755 --- a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/ConnectedProjectionScenarioExtensions.cs +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.Testing/ConnectedProjectionScenarioExtensions.cs @@ -21,7 +21,7 @@ public static ConnectedProjectionTestSpecification Expect { - var actualEntities = await query(ctx).ToListAsync(); + var actualEntities = await query(ctx).ToListAsync().ConfigureAwait(false); if (actualEntities.Count != expectedEntities.Length) return VerificationResult.Fail( $" Expected {expectedEntities.Length} entities, but found {actualEntities.Count} entities. {actualEntities.ToLogStringLimited(max: 10)}"); @@ -66,7 +66,7 @@ public static ConnectedProjectionTestSpecification ExpectNone { - var actualEntities = await query(ctx).ToListAsync(); + var actualEntities = await query(ctx).ToListAsync().ConfigureAwait(false); if (actualEntities.Count > 0) return VerificationResult.Fail( $" Expected none, but found {actualEntities.Count} entities. {actualEntities.ToLogStringLimited(max: 10)}"); diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.csproj.DotSettings b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.csproj.DotSettings new file mode 100644 index 0000000..89316e4 --- /dev/null +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector/Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.csproj.DotSettings @@ -0,0 +1,2 @@ + + Library \ No newline at end of file diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.csproj.DotSettings b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.csproj.DotSettings new file mode 100644 index 0000000..89316e4 --- /dev/null +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList/Be.Vlaanderen.Basisregisters.ProjectionHandling.LastChangedList.csproj.DotSettings @@ -0,0 +1,2 @@ + + Library \ No newline at end of file diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.csproj.DotSettings b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.csproj.DotSettings new file mode 100644 index 0000000..89316e4 --- /dev/null +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.csproj.DotSettings @@ -0,0 +1,2 @@ + + Library \ No newline at end of file diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Runner.cs b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Runner.cs index b2497e1..74755d2 100755 --- a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Runner.cs +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner/Runner.cs @@ -97,11 +97,11 @@ private void CreateSubscription(IReadonlyStreamStore streamStore, Func p.Name == RunnerName, cancellationToken); + .SingleOrDefaultAsync(p => p.Name == RunnerName, cancellationToken).ConfigureAwait(false); position = dbPosition?.Position; } // discover head position - var head = await streamStore.ReadHeadPosition(cancellationToken); + var head = await streamStore.ReadHeadPosition(cancellationToken).ConfigureAwait(false); // determine whether to play catch up or start subscribing var shouldCatchUp = position.HasValue @@ -181,11 +181,11 @@ private async Task StartAsyncInternal( if (_envelopeFactory.TryCreate(message, out var envelope)) { await using var context = contextFactory().Value; - await context.UpdateProjectionState(RunnerName, message.Position, cancellationToken); + await context.UpdateProjectionState(RunnerName, message.Position, cancellationToken).ConfigureAwait(false); - await _projector.ProjectAsync(context, envelope, cancellationToken); + await _projector.ProjectAsync(context, envelope, cancellationToken).ConfigureAwait(false); - await context.SaveChangesAsync(cancellationToken); + await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false); } else { @@ -201,9 +201,9 @@ private async Task StartAsyncInternal( { _logger.LogWarning(exception, "Subscription {SubscriptionName} was dropped. Reason: {Reason}", subscription.Name, reason); - await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); + await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken).ConfigureAwait(false); - await StartAsyncInternal(streamStore, contextFactory, cancellationToken); + await StartAsyncInternal(streamStore, contextFactory, cancellationToken).ConfigureAwait(false); })); } } @@ -220,7 +220,7 @@ private async Task CatchUpAsync(IReadonlyStreamStore streamStore, Func item.Name == projectionName, cancellationToken); + var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken).ConfigureAwait(false); if (projectionStateItem == null) { projectionStateItem = new ProjectionStateItem { Name = projectionName }; - await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); + await ProjectionStates.AddAsync(projectionStateItem, cancellationToken).ConfigureAwait(false); } projectionStateItem.Position = position; @@ -61,7 +61,7 @@ public virtual async Task UpdateProjectionState(string? projectionName, long pos public virtual async Task SetErrorMessage(string projectionName, string? errorMessage, CancellationToken cancellationToken) { - var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken); + var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken).ConfigureAwait(false); if (projectionStateItem == null) { @@ -70,7 +70,7 @@ public virtual async Task SetErrorMessage(string projectionName, string? errorMe Name = projectionName, Position = -1L }; - await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); + await ProjectionStates.AddAsync(projectionStateItem, cancellationToken).ConfigureAwait(false); } projectionStateItem.ErrorMessage = errorMessage; @@ -78,7 +78,7 @@ public virtual async Task SetErrorMessage(string projectionName, string? errorMe public virtual async Task UpdateProjectionDesiredState(string projectionName, string desiredState, CancellationToken cancellationToken) { - var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken); + var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken).ConfigureAwait(false); if (projectionStateItem == null) { @@ -87,7 +87,7 @@ public virtual async Task UpdateProjectionDesiredState(string projectionName, st Name = projectionName, Position = -1L }; - await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); + await ProjectionStates.AddAsync(projectionStateItem, cancellationToken).ConfigureAwait(false); } projectionStateItem.DesiredState = desiredState; diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.csproj.DotSettings b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.csproj.DotSettings new file mode 100644 index 0000000..89316e4 --- /dev/null +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication.csproj.DotSettings @@ -0,0 +1,2 @@ + + Library \ No newline at end of file diff --git a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/FeedProjectionRunner.cs b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/FeedProjectionRunner.cs index ee4fe76..8685e01 100644 --- a/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/FeedProjectionRunner.cs +++ b/src/Be.Vlaanderen.Basisregisters.ProjectionHandling.Syndication/FeedProjectionRunner.cs @@ -29,7 +29,7 @@ public class FeedProjectionRunner : IFeedProjectio private readonly IRegistryAtomFeedReader _atomFeedReader; private readonly DataContractSerializer _dataContractSerializer; private readonly AtomEntryProjectionHandlerResolver _atomEntryProjectionHandlerResolver; - + public string RunnerName { get; } public Uri FeedUri { get; } public string FeedUserName { get; } @@ -73,7 +73,7 @@ public async Task CatchUpAsync( { var dbPosition = await context .ProjectionStates - .SingleOrDefaultAsync(p => p.Name == RunnerName, cancellationToken); + .SingleOrDefaultAsync(p => p.Name == RunnerName, cancellationToken).ConfigureAwait(false); position = dbPosition?.Position + 1; } @@ -81,7 +81,7 @@ public async Task CatchUpAsync( while (!cancellationToken.IsCancellationRequested) { // Read new events - var entries = (await _atomFeedReader.ReadEntriesAsync(FeedUri, position, FeedUserName, FeedPassword, EmbedEvent, EmbedObject)).ToList(); + var entries = (await _atomFeedReader.ReadEntriesAsync(FeedUri, position, FeedUserName, FeedPassword, EmbedEvent, EmbedObject).ConfigureAwait(false)).ToList(); while (entries.Any()) { @@ -92,14 +92,14 @@ public async Task CatchUpAsync( await using (var context = contextFactory().Value) { - await ProjectAtomEntriesAsync(entries, context, cancellationToken); + await ProjectAtomEntriesAsync(entries, context, cancellationToken).ConfigureAwait(false); - await context.UpdateProjectionState(RunnerName, lastEntryId, cancellationToken); - await context.SaveChangesAsync(cancellationToken); + await context.UpdateProjectionState(RunnerName, lastEntryId, cancellationToken).ConfigureAwait(false); + await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false); } position = lastEntryId + 1; - entries = (await _atomFeedReader.ReadEntriesAsync(FeedUri, position, FeedUserName, FeedPassword, EmbedEvent, EmbedObject)).ToList(); + entries = (await _atomFeedReader.ReadEntriesAsync(FeedUri, position, FeedUserName, FeedPassword, EmbedEvent, EmbedObject).ConfigureAwait(false)).ToList(); } Thread.Sleep(_pollingInMilliseconds); @@ -128,7 +128,7 @@ private async Task ProjectAtomEntriesAsync( { await resolvedProjectionHandler .Handler - .Invoke(atomEntry, context, cancellationToken); + .Invoke(atomEntry, context, cancellationToken).ConfigureAwait(false); } } }