diff --git a/src/Febe.App/FebeApp.cs b/src/Febe.App/FebeApp.cs
index 7339236..0a2fd31 100644
--- a/src/Febe.App/FebeApp.cs
+++ b/src/Febe.App/FebeApp.cs
@@ -744,14 +744,14 @@ public sealed class FebeApp : IAsyncDisposable
}
}
+ /// Tests only: the composition started the automatic export (a normal start; never with problems).
+ internal bool AutoExportStarted => _autoExport is not null;
+
///
/// The start-up line of the engine, with what it waits for: the same state as the engine's own gate
/// (), so that the log never says «collegato» while the monitor
/// says «Serve «Ho finito»».
///
- /// Tests only: the composition started the automatic export (a normal start; never with problems).
- internal bool AutoExportStarted => _autoExport is not null;
-
internal static string StartedMessage(BrowserConnectionService connection)
{
ArgumentNullException.ThrowIfNull(connection);
@@ -948,8 +948,8 @@ public sealed class FebeApp : IAsyncDisposable
}
///
- /// Stops everything in order: the shell's own first (remote view), interface, engine, downloads, alerts, import,
- /// pipeline, browser, database.
+ /// Stops everything in order: the shell's own first (remote view), then the automatic export (tappa E5), interface,
+ /// engine, downloads, alerts, import, pipeline, browser, database.
///
public async ValueTask DisposeAsync()
{
diff --git a/src/Febe.Web/Api/ExportApi.cs b/src/Febe.Web/Api/ExportApi.cs
index 953f369..412e147 100644
--- a/src/Febe.Web/Api/ExportApi.cs
+++ b/src/Febe.Web/Api/ExportApi.cs
@@ -276,13 +276,14 @@ public static class ExportApi
endpoints.MapPost("/api/export/automatic/resume", async (ExportHub hub, IServiceProvider services, CancellationToken ct) =>
{
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);
}
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();
}
diff --git a/tests/Febe.Tests/Web/ExportApiTests.Automatic.cs b/tests/Febe.Tests/Web/ExportApiTests.Automatic.cs
index 6d7c101..b40c3dc 100644
--- a/tests/Febe.Tests/Web/ExportApiTests.Automatic.cs
+++ b/tests/Febe.Tests/Web/ExportApiTests.Automatic.cs
@@ -368,6 +368,14 @@ public sealed partial class ExportApiTests
var worker = server.App.Services.GetRequiredService();
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().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();
var loop = Task.Run(() => worker.RunAsync(stop.Token));
try