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.Assets;
using Squidex.Hosting; 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 static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(30);
private readonly DumperOptions options; private readonly DiagnoserOptions options;
private readonly IAssetStore assetStore; private readonly IAssetStore assetStore;
private Task? scheduledGcDumpTask; private Task? scheduledGcDumpTask;
private Task? scheduledDumpTask; private Task? scheduledDumpTask;
@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.Dump
public int Order => int.MaxValue; public int Order => int.MaxValue;
public Dumper(IOptions<DumperOptions> options, IAssetStore assetStore) public Diagnoser(IOptions<DiagnoserOptions> options, IAssetStore assetStore)
{ {
this.options = options.Value; this.options = options.Value;
this.assetStore = assetStore; this.assetStore = assetStore;
@ -32,7 +32,7 @@ namespace Squidex.Infrastructure.Dump
public Task InitializeAsync( public Task InitializeAsync(
CancellationToken ct) CancellationToken ct)
{ {
if (options.DumTrigger > 0 || options.GCDumpTrigger > 0) if (options.DumpTrigger > 0 || options.GCDumpTrigger > 0)
{ {
timer = new Timer(CollectDump); timer = new Timer(CollectDump);
timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(5)); timer.Change(TimeSpan.Zero, TimeSpan.FromSeconds(5));
@ -70,7 +70,7 @@ namespace Squidex.Infrastructure.Dump
{ {
var usage = GC.GetTotalMemory(false) / (1024 * 1024); 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(); scheduledDumpTask = CreateDumpAsync();
} }
@ -84,7 +84,6 @@ namespace Squidex.Infrastructure.Dump
catch catch
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #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. // 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; } public string? GcDumpTool { get; set; }
@ -15,6 +15,6 @@ namespace Squidex.Infrastructure.Dump
public int GCDumpTrigger { get; set; } 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> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Dump\" />
</ItemGroup>
</Project> </Project>

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

@ -7,7 +7,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Dump; using Squidex.Infrastructure.Diagnostics;
using Squidex.Shared; using Squidex.Shared;
using Squidex.Web; using Squidex.Web;
@ -19,9 +19,9 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics
[ApiExplorerSettings(GroupName = nameof(Diagnostics))] [ApiExplorerSettings(GroupName = nameof(Diagnostics))]
public sealed class DiagnosticsController : ApiController 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) : base(commandBus)
{ {
this.dumper = dumper; this.dumper = dumper;
@ -57,7 +57,7 @@ namespace Squidex.Areas.Api.Controllers.Diagnostics
/// 501 => Not configured. /// 501 => Not configured.
/// </returns> /// </returns>
[HttpGet] [HttpGet]
[Route("diagnostics/gc-dump")] [Route("diagnostics/gcdump")]
[ApiPermissionOrAnonymous(Permissions.Admin)] [ApiPermissionOrAnonymous(Permissions.Admin)]
public async Task<IActionResult> GetGCDump() 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.Domain.Apps.Entities.Tags;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Dump; using Squidex.Infrastructure.Diagnostics;
using Squidex.Infrastructure.EventSourcing.Grains; using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Orleans;
@ -51,7 +51,7 @@ namespace Squidex.Config.Domain
services.Configure<JintScriptOptions>(config, services.Configure<JintScriptOptions>(config,
"scripting"); "scripting");
services.Configure<DumperOptions>(config, services.Configure<DiagnoserOptions>(config,
"diagnostics"); "diagnostics");
services.AddReplicatedCache(); services.AddReplicatedCache();
@ -67,7 +67,7 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<BackgroundRequestLogStore>() services.AddSingletonAs<BackgroundRequestLogStore>()
.AsOptional<IRequestLogStore>(); .AsOptional<IRequestLogStore>();
services.AddSingletonAs<Dumper>() services.AddSingletonAs<Diagnoser>()
.AsSelf(); .AsSelf();
services.AddSingletonAs<ScriptingCompleter>() services.AddSingletonAs<ScriptingCompleter>()

Loading…
Cancel
Save