E5: commenti di FebeApp e «Riprendi ora» senza segnale a lavoratore fermo
La proprietà AutoExportStarted stava fra la documentazione di StartedMessage e il metodo; il riassunto di DisposeAsync non diceva che la copia automatica si ferma per prima. L'API «Riprendi ora» chiede una passata solo se il lavoratore gira davvero: è registrato sempre, ma nella dimostrazione e in un avvio con problemi non gira e nessuno ascolta il segnale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ff748db6f
commit
c0e04d2930
3 files changed
+16
-7
No files matched your search
@@ -744,14 +744,14 @@ public sealed class FebeApp : IAsyncDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Tests only: the composition started the automatic export (a normal start; never with problems).</summary>
|
||||||
|
internal bool AutoExportStarted => _autoExport is not null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The start-up line of the engine, with what it waits for: the same state as the engine's own gate
|
/// The start-up line of the engine, with what it waits for: the same state as the engine's own gate
|
||||||
/// (<see cref="BrowserConnectionService.IsReadyToCollect"/>), so that the log never says «collegato» while the monitor
|
/// (<see cref="BrowserConnectionService.IsReadyToCollect"/>), so that the log never says «collegato» while the monitor
|
||||||
/// says «Serve «Ho finito»».
|
/// says «Serve «Ho finito»».
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <summary>Tests only: the composition started the automatic export (a normal start; never with problems).</summary>
|
|
||||||
internal bool AutoExportStarted => _autoExport is not null;
|
|
||||||
|
|
||||||
internal static string StartedMessage(BrowserConnectionService connection)
|
internal static string StartedMessage(BrowserConnectionService connection)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(connection);
|
ArgumentNullException.ThrowIfNull(connection);
|
||||||
@@ -948,8 +948,8 @@ public sealed class FebeApp : IAsyncDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops everything in order: the shell's own first (remote view), interface, engine, downloads, alerts, import,
|
/// Stops everything in order: the shell's own first (remote view), then the automatic export (tappa E5), interface,
|
||||||
/// pipeline, browser, database.
|
/// engine, downloads, alerts, import, pipeline, browser, database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async ValueTask DisposeAsync()
|
public async ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -276,13 +276,14 @@ public static class ExportApi
|
|||||||
endpoints.MapPost("/api/export/automatic/resume", async (ExportHub hub, IServiceProvider services, CancellationToken ct) =>
|
endpoints.MapPost("/api/export/automatic/resume", async (ExportHub hub, IServiceProvider services, CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
var service = await hub.GetAsync(ct).ConfigureAwait(false);
|
var service = await hub.GetAsync(ct).ConfigureAwait(false);
|
||||||
if (services.GetService(typeof(AutoExportWorker)) is AutoExportWorker worker)
|
if (services.GetService(typeof(AutoExportWorker)) is AutoExportWorker { Running: true } worker)
|
||||||
{
|
{
|
||||||
await worker.ResumeNowAsync(ct).ConfigureAwait(false);
|
await worker.ResumeNowAsync(ct).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No worker (the demonstration, a start with problems): nothing to wake, the API sends no signal.
|
// The worker is registered always but runs only after a normal start (not in the demonstration, not in a
|
||||||
|
// start with problems): nothing to wake, the API sends no signal.
|
||||||
service.ReleaseAutomaticHold();
|
service.ReleaseAutomaticHold();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -368,6 +368,14 @@ public sealed partial class ExportApiTests
|
|||||||
var worker = server.App.Services.GetRequiredService<AutoExportWorker>();
|
var worker = server.App.Services.GetRequiredService<AutoExportWorker>();
|
||||||
Assert.AreEqual(JsonValueKind.Null, (await server.GetJsonAsync("/api/export")).GetProperty("automatic").ValueKind, "not started yet");
|
Assert.AreEqual(JsonValueKind.Null, (await server.GetJsonAsync("/api/export")).GetProperty("automatic").ValueKind, "not started yet");
|
||||||
|
|
||||||
|
// Registered but not running: «Riprendi ora» releases the hold and asks no pass, since nothing listens.
|
||||||
|
var idle = await server.App.Services.GetRequiredService<ExportHub>().GetAsync();
|
||||||
|
idle.HoldAutomatic(clock.Now + TimeSpan.FromHours(1));
|
||||||
|
var signals = signal.Count;
|
||||||
|
Assert.AreEqual(HttpStatusCode.OK, (await server.SendJsonAsync(HttpMethod.Post, "/api/export/automatic/resume")).Status);
|
||||||
|
Assert.IsNull(idle.AutomaticHeldUntil);
|
||||||
|
Assert.AreEqual(signals, signal.Count, "no signal without the loop");
|
||||||
|
|
||||||
using var stop = new CancellationTokenSource();
|
using var stop = new CancellationTokenSource();
|
||||||
var loop = Task.Run(() => worker.RunAsync(stop.Token));
|
var loop = Task.Run(() => worker.RunAsync(stop.Token));
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in new issue
Block a user