Browse Source

Another naming improvement.

pull/883/head
Sebastian 4 years ago
parent
commit
9aa88d1507
  1. 13
      backend/src/Squidex.Infrastructure/Diagnostics/Diagnoser.cs
  2. 6
      backend/src/Squidex.Infrastructure/Diagnostics/DiagnoserOptions.cs
  3. 3
      backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj
  4. 8
      backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs
  5. 6
      backend/src/Squidex/Config/Domain/InfrastructureServices.cs

13
backend/src/Squidex.Infrastructure/Dump/Dumper.cs → backend/src/Squidex.Infrastructure/Diagnostics/Diagnoser.cs

@ -10,12 +10,12 @@ using Microsoft.Extensions.Options;
using Squidex.Assets;
using Squidex.Hosting;
namespace Squidex.Infrastructure.Dump
namespace Squidex.Infrastructure.Diagnostics
{
public sealed class Dumper : IInitializable
public sealed class Diagnoser : IInitializable
{
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(30);
private readonly DumperOptions options;
private readonly DiagnoserOptions options;
private readonly IAssetStore assetStore;
private Task? scheduledGcDumpTask;
private Task? scheduledDumpTask;
@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.Dump
public int Order => int.MaxValue;
public Dumper(IOptions<DumperOptions> options, IAssetStore assetStore)
public Diagnoser(IOptions<DiagnoserOptions> options, IAssetStore assetStore)
{
this.options = options.Value;
this.assetStore = assetStore;
@ -32,7 +32,7 @@ namespace Squidex.Infrastructure.Dump
public Task InitializeAsync(
CancellationToken ct)
{
if (options.DumTrigger > 0 || options.GCDumpTrigger > 0)
if (options.DumpTrigger > 0 || options.GCDumpTrigger > 0)
{
timer = new Timer(CollectDump);
timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(5));
@ -70,7 +70,7 @@ namespace Squidex.Infrastructure.Dump
{
var usage = GC.GetTotalMemory(false) / (1024 * 1024);
if (options.DumTrigger > 0 && usage > options.DumTrigger && scheduledDumpTask == null)
if (options.DumpTrigger > 0 && usage > options.DumpTrigger && scheduledDumpTask == null)
{
scheduledDumpTask = CreateDumpAsync();
}
@ -84,7 +84,6 @@ namespace Squidex.Infrastructure.Dump
catch
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
{
}
}

6
backend/src/Squidex.Infrastructure/Dump/DumperOptions.cs → backend/src/Squidex.Infrastructure/Diagnostics/DiagnoserOptions.cs

@ -5,9 +5,9 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
namespace Squidex.Infrastructure.Dump
namespace Squidex.Infrastructure.Diagnostics
{
public sealed class DumperOptions
public sealed class DiagnoserOptions
{
public string? GcDumpTool { get; set; }
@ -15,6 +15,6 @@ namespace Squidex.Infrastructure.Dump
public int GCDumpTrigger { get; set; }
public int DumTrigger { get; set; }
public int DumpTrigger { get; set; }
}
}

3
backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj

@ -62,4 +62,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Dump\" />
</ItemGroup>
</Project>

8
backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs

@ -7,7 +7,7 @@
using Microsoft.AspNetCore.Mvc;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Dump;
using Squidex.Infrastructure.Diagnostics;
using Squidex.Shared;
using Squidex.Web;
@ -19,9 +19,9 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics
[ApiExplorerSettings(GroupName = nameof(Diagnostics))]
public sealed class DiagnosticsController : ApiController
{
private readonly Dumper dumper;
private readonly Diagnoser dumper;
public DiagnosticsController(ICommandBus commandBus, Dumper dumper)
public DiagnosticsController(ICommandBus commandBus, Diagnoser dumper)
: base(commandBus)
{
this.dumper = dumper;
@ -57,7 +57,7 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics
/// 501 => Not configured.
/// </returns>
[HttpGet]
[Route("diagnostics/gc-dump")]
[Route("diagnostics/gcdump")]
[ApiPermissionOrAnonymous(Permissions.Admin)]
public async Task<IActionResult> GetGCDump()
{

6
backend/src/Squidex/Config/Domain/InfrastructureServices.cs

@ -23,7 +23,7 @@ using Squidex.Domain.Apps.Entities.Rules.UsageTracking;
using Squidex.Domain.Apps.Entities.Tags;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Dump;
using Squidex.Infrastructure.Diagnostics;
using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Orleans;
@ -51,7 +51,7 @@ namespace Squidex.Config.Domain
services.Configure<JintScriptOptions>(config,
"scripting");
services.Configure<DumperOptions>(config,
services.Configure<DiagnoserOptions>(config,
"diagnostics");
services.AddReplicatedCache();
@ -67,7 +67,7 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<BackgroundRequestLogStore>()
.AsOptional<IRequestLogStore>();
services.AddSingletonAs<Dumper>()
services.AddSingletonAs<Diagnoser>()
.AsSelf();
services.AddSingletonAs<ScriptingCompleter>()

Loading…
Cancel
Save