Hero: zelftest en mapcontrole van de media draaien op de achtergrond, zodat de host niet later gaat luisteren

De hosted services starten voor de webserver; de zelftest van Magick (laden van de native bibliotheek en een testcodering) kostte op de Pi ongeveer 9 s voordat de host luisterde.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 17:20:59 +01:00
co-authored by Claude Sonnet 5.5
parent bd283d629d
commit 01703ccddf
5 changed files with 102 additions and 34 deletions
@@ -81,6 +81,9 @@ public class HeroAsfSiteE2ETests : IClassFixture<AsfSiteFactory>
var client = _factory.CreateClient();
var caller = Guid.NewGuid();
// The image library self-test and the media directory check run in the background after start-up.
var status = _factory.Services.GetRequiredService<SlpModularCms.Core.Media.MediaStatus>();
for (var i = 0; i < 300 && !status.UploadsAvailable; i++) await Task.Delay(100);
await InScope(async sp =>
{
var db = sp.GetRequiredService<HeroDbContext>();
@@ -59,7 +59,10 @@ public class HeroInjectionPipelineTests : IClassFixture<HeroInjectionFactory>
private async Task<T> InScope<T>(Func<IServiceProvider, Task<T>> action)
{
_ = _factory.CreateClient(); // starts the host, migrates and runs the start-up checks
_ = _factory.CreateClient(); // starts the host, migrates and starts the start-up checks
// The image library self-test and the media directory check run in the background after start-up.
var status = _factory.Services.GetRequiredService<SlpModularCms.Core.Media.MediaStatus>();
for (var i = 0; i < 300 && !status.UploadsAvailable; i++) await Task.Delay(100);
await using var scope = _factory.Services.CreateAsyncScope();
return await action(scope.ServiceProvider);
}