Prove che cadevano con il runner carico (#46)
Le prove cadevano a ogni carico della CI, ogni volta prove diverse. Dietro alcune c'erano difetti veri: FebeDatabase lasciava i file aperti dopo DisposeAsync (comandi SQLite non chiusi, pool di lettura chiuso dopo lo scrittore), e il WAL spariva durante lo spostamento della cartella Dati; la scheda dell'account senza statistiche leggeva i file di tutta la libreria; l'arresto di FebeApp non aspettava i lavori aggiunti da un avvio in corso. Chromium ha 120 s per avviarsi e aprire la prima scheda, e il ricollegamento smette appena il processo cambia. Nelle prove i limiti di tempo diventano protezioni contro un blocco: attese per condizione con un aiuto comune, limiti per classe nella prova di scala con il tempo migliore, porta 0 e stderr di Chromium nel browser delle prove, e la prova di «Scollega» di WebView2 controlla che il processo esca davvero. Provato su Windows con tutti i core occupati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e2e64c09e8
commit
0775a1460f
34 files changed
+875
-245
No files matched your search
@@ -145,16 +145,38 @@ public sealed class RealBrowser : IAsyncDisposable
|
||||
throw new InvalidOperationException($"Navigazione fallita: {result.ErrorText}");
|
||||
}
|
||||
|
||||
if (!await Cdp.WaitForLoadAsync(Clock, TimeSpan.FromSeconds(15)))
|
||||
// The limit only bounds a hang: the wait ends with the load (#46).
|
||||
if (!await Cdp.WaitForLoadAsync(Clock, TimeSpan.FromSeconds(60)))
|
||||
{
|
||||
throw new TimeoutException("La pagina non ha finito di caricare.");
|
||||
}
|
||||
|
||||
// Like the post-load wait of the recipes (1–6 s, shortened here): Chromium ignores input that arrives
|
||||
// right after a navigation, before the page has painted.
|
||||
// right after a navigation, before the page has painted. On a loaded runner the first paint comes later.
|
||||
await WaitForPaintAsync();
|
||||
await Task.Delay(SettleAfterLoad);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits until the page reports its first paint (a read-only look at the paint entries), up to 15 s. Not reported
|
||||
/// in time is not an error: the settle after it stays as before.
|
||||
/// </summary>
|
||||
public async Task<bool> WaitForPaintAsync()
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
while (watch.Elapsed < TimeSpan.FromSeconds(15))
|
||||
{
|
||||
if (await EvalAsync<bool>("performance.getEntriesByType('paint').length > 0"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
await Task.Delay(50);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static TimeSpan SettleAfterLoad { get; } = TimeSpan.FromMilliseconds(500);
|
||||
|
||||
public async Task<T> EvalAsync<T>(string expression) =>
|
||||
|
||||
Reference in new issue
Block a user