diff --git a/src/ServiceControl.Audit/Infrastructure/WebApi/CachingHttpHandler.cs b/src/ServiceControl.Audit/Infrastructure/WebApi/CachingHttpHandler.cs index 6a9205cef8..1d6b2afba3 100644 --- a/src/ServiceControl.Audit/Infrastructure/WebApi/CachingHttpHandler.cs +++ b/src/ServiceControl.Audit/Infrastructure/WebApi/CachingHttpHandler.cs @@ -6,7 +6,6 @@ class CachingHttpHandler : IResultFilter { public void OnResultExecuting(ResultExecutingContext context) { - // TODO do we even need to do this var response = context.HttpContext.Response; if (!response.Headers.ContainsKey("Cache-Control")) { diff --git a/src/ServiceControl.Monitoring/HostApplicationBuilderExtensions.cs b/src/ServiceControl.Monitoring/HostApplicationBuilderExtensions.cs index f263eb8363..8c91ff96f6 100644 --- a/src/ServiceControl.Monitoring/HostApplicationBuilderExtensions.cs +++ b/src/ServiceControl.Monitoring/HostApplicationBuilderExtensions.cs @@ -53,9 +53,7 @@ public static class HostApplicationBuilderExtensions services.AddHttpLogging(options => { - // TODO Do we need to expose the host? - // we could also include the time it took to process the request - options.LoggingFields = HttpLoggingFields.RequestPath | HttpLoggingFields.RequestMethod | HttpLoggingFields.ResponseStatusCode; + options.LoggingFields = HttpLoggingFields.RequestPath | HttpLoggingFields.RequestMethod | HttpLoggingFields.ResponseStatusCode | HttpLoggingFields.Duration; }); // Core registers the message dispatcher to be resolved from the transport seam. The dispatcher diff --git a/src/ServiceControl.Monitoring/WebApplicationExtensions.cs b/src/ServiceControl.Monitoring/WebApplicationExtensions.cs index 7ab2664754..17969bc733 100644 --- a/src/ServiceControl.Monitoring/WebApplicationExtensions.cs +++ b/src/ServiceControl.Monitoring/WebApplicationExtensions.cs @@ -10,9 +10,6 @@ public static void UseServiceControlMonitoring(this WebApplication appBuilder) appBuilder.UseCors(policyBuilder => { - // TODO verify that the default is no headers and no methods allowed - //builder.AllowAnyHeader(); - //builder.AllowAnyMethod(); policyBuilder.AllowAnyOrigin(); policyBuilder.WithExposedHeaders(["ETag", "Last-Modified", "Link", "Total-Count", "X-Particular-Version"]); policyBuilder.WithHeaders(["Origin", "X-Requested-With", "Content-Type", "Accept"]); diff --git a/src/ServiceControl.Persistence.RavenDB/ErrorMessagesDataStore.cs b/src/ServiceControl.Persistence.RavenDB/ErrorMessagesDataStore.cs index 4894018637..3c944cf7f4 100644 --- a/src/ServiceControl.Persistence.RavenDB/ErrorMessagesDataStore.cs +++ b/src/ServiceControl.Persistence.RavenDB/ErrorMessagesDataStore.cs @@ -609,34 +609,26 @@ public async Task RemoveFailedMessageRetryDocument(string uniqueMessageId) await session.Advanced.RequestExecutor.ExecuteAsync(new DeleteDocumentCommand(FailedMessageRetry.MakeDocumentId(uniqueMessageId), null), session.Advanced.Context); } - // TODO: Once using .NET, consider using IAsyncEnumerable here as this is an unbounded query public async Task GetRetryPendingMessages(DateTime from, DateTime to, string queueAddress) { - var ids = new List(); - using var session = documentStore.OpenAsyncSession(); - var query = session.Advanced - .AsyncDocumentQuery() - .WhereEquals("Status", (int)FailedMessageStatus.RetryIssued) - .AndAlso() - .WhereBetween(options => options.LastModified, from.Ticks, to.Ticks) - .AndAlso() - .WhereEquals(o => o.QueueAddress, queueAddress) - .SelectFields() - .ToQueryable() - .TransformToFailedMessageView(); - - await using (var ie = await session.Advanced.StreamAsync(query)) + var query = session + .Query() + .Where(o => o.Status == FailedMessageStatus.RetryIssued && o.LastModified >= from.Ticks && o.LastModified <= to.Ticks && o.QueueAddress == queueAddress) + .OfType(); + + int index = 0; + await using var streamResults = await session.Advanced.StreamAsync(query, out var streamQueryStatistics); + string[] ids = new string[streamQueryStatistics.TotalResults]; + while (await streamResults.MoveNextAsync()) { - while (await ie.MoveNextAsync()) - { - ids.Add(ie.Current.Document.Id); - } + ids[index++] = streamResults.Current.Document.UniqueMessageId; } - - return ids.ToArray(); + return ids; } + record struct FailedMessageProjection(string UniqueMessageId); + public async Task FetchFromFailedMessage(string uniqueMessageId) { byte[] body = null; diff --git a/src/ServiceControl/Hosting/Commands/MaintenanceModeCommand.cs b/src/ServiceControl/Hosting/Commands/MaintenanceModeCommand.cs index 6941a0bc67..bd2e23a1ff 100644 --- a/src/ServiceControl/Hosting/Commands/MaintenanceModeCommand.cs +++ b/src/ServiceControl/Hosting/Commands/MaintenanceModeCommand.cs @@ -26,9 +26,7 @@ public override async Task Execute(HostArguments args, Settings settings) hostBuilder.Services.AddSingleton(); } - // TODO: Update to use the same pattern as the main Bootstrapper var host = hostBuilder.Build(); - await host.RunAsync(); } } diff --git a/src/ServiceControl/Infrastructure/SignalR/MessageStreamerHub.cs b/src/ServiceControl/Infrastructure/SignalR/MessageStreamerHub.cs index 0a56add6e8..7f398e35dd 100644 --- a/src/ServiceControl/Infrastructure/SignalR/MessageStreamerHub.cs +++ b/src/ServiceControl/Infrastructure/SignalR/MessageStreamerHub.cs @@ -27,7 +27,6 @@ public MessageStreamerHub(IMessageDispatcher sender, IReadOnlySettings settings, localAddress = receiveAddresses.MainReceiveAddress; } - // TODO Change service pulse to call this method instead? public async Task SendMessage(string data) { try